Re: atexit

new topic     » goto parent     » topic index » view thread      » older message » newer message

Al Getz wrote:
> 
> Robert Craig wrote:
> > 
> > ags wrote:
> > > After serious digging through the reference manual I still can't find
> > > anything
> > > that performs a function similar to C's atexit().
> > > 
> > > Mainly to Robert Craig, are there any plans to incorporate such a feature
> > > into
> > > Euphoria?
> > > 
> > > Since crash_routine exists, it would seem to me that the functionality
> > > would
> > > not be too hard to implement?  crash_routine even seems to behave
> > > similarly
> > > to atexit smile
> > 
> > In over 20 years of C programming, I've never used atexit().
> > But after looking it up, it seems to me it would be very easy
> > for you to just define a termination routine that you call 
> > at the end of execution of your program. To make it a bit fancier, 
> > and more like C's atexit(), you could append the routine id of 
> > one or more Euphoria routines onto a sequence. Your termination 
> > routine could step through this sequence calling each routine
> > in turn.
> > 
> > Regards,
> >    Rob Craig
> >    Rapid Deployment Software
> >    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
> 
> Hello,
> 
> For an example of just how handy this can be, see "ReTrack.ew" in my
> WinClass library.
> 
>   Cleanup manager overview:
> 
> Procedure "AddCleanup(atom rid)" adds another cleanup routine to the
> list.  At the end of your program (due to error or normal end) you call
> "Cleanup()", which goes though the list of rid's and calls each and
> every one of them before allowing the program to abort.
> This is very handy because each 'class' (or simply each include file)
> could have it's own cleanup routine which takes care of any local
> cleanup of memory, handles, fonts handles, etc., that needs to be
> deleted or free'd.  When "Cleanup()" is called, the rid's get called
> one after the other.
> 

Hi

Forgive me if I'm wrong, aren't these released when the interpreter exits -
if not wouldn't there be more significant (any) memory leaks?

Chris

> 
> Al
> 
> 
> My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu