[patches] avoid unless exit()
Greg A. Woods
woods-cyrus at weird.com
Tue Mar 30 11:31:47 EDT 2010
At Tue, 30 Mar 2010 02:48:28 +0100, Thomas Cataldo <tcataldo at gmail.com> wrote:
Subject: Re: [patches] avoid unless exit()
> Relying on exit freeing up memory is pretty lazy as it prevents switching to
That makes no sense at all -- all threads exit when exit() is called.
If use of threads causes the code to change so much that exit() will no
longer be called at the end of some code path where it is now called
then for certain you'll have to be very careful how you write the new
code and be certain to also deal appropriately with all the other
resources which would otherwise be released by the exit() call.
> I'm only a java programmer using cyrus for its webmail need by I think that
> fork/leak/leak/exit is a bad programming model.
How is that different from the pedantic fork()/malloc()...free()/exit()
What about all the other resources exit() implicitly releases?
You'd better be very pedantic about all of them! Perhaps you should
even call sbrk() to be sure the heap is shrunk back down first too
(though few malloc() implementations have a safe way to reset themselves
to handle this case)!
BTW, it's not a "model" per se -- just a simple practice. :-)
Unless you're hinting at the larger model of properly using separate
processes to manage separate threads of execution.....
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <woods at robohack.ca>
Planix, Inc. <woods at planix.com> Secrets of the Weird <woods at weird.com>
More information about the Info-cyrus