Dan Sugalski wrote:

At 1:47 PM -0500 11/6/02, Josh Wilmes wrote:

At 13:41 on 11/06/2002 EST, Dan Sugalski <[EMAIL PROTECTED]> wrote:

 Well, I got bit this week by the on_exit stuff. I'm still not sure
 why we need this. Could someone please explain, so I don't have to
 yank it out?

Leo said:

The on_exit/atexit is currently necessary to clean up behind exceptions.
If you don't mind memory leaks after exceptions, remove the

#define ATEXIT_DESTROY

at the beginning of interpreter.c, until we have a config test for on_exit.

atexit is not an alternative, because we might have multiple
interpreters to clean up like in t/op/interp_2.

Right, I saw that, I just don't understand why. If it's in as a fix for the current busted state of exceptions, then we need to fix exceptions, I think.

Summary of changes I did put in WRT this:
- interpreter startup code is reordered so that all PMCs/Buffers are in managed memory now.
- Long running programs using e.g. new interpreters on the fly would currently leak tons of memory.
- Debugging memory corruptions is a pain, when there is a lot of leaking memory
- freeing all used memory is a good measure against corrupted mem, so
- I implemented Parrot_destroy, which cleans up all internal data structures of an interpreter and frees all used mem.

This is currently ok for:

Failed Test Status Wstat Total Fail Failed List of failed
-------------------------------------------------------------------------------
t/op/hacks.t 2 1 50,00% 1
t/op/rx.t 23 7 30,43% 8-9, 12-14, 21-22
t/pmc/pmc.t 82 4 4,88% 60-62, 74
9 subtests skipped.
Failed 3/34 test scripts, 91.18% okay. 12/494 subtests failed, 97.57% okay.

(Above is produced by "testyamd", which includes mem leaks as failures)

Above leaks are known why/where they come from.

Not too few tests use exceptions to show some wanted error message, so I used atexit first, to catch these.

on_exit() jumped in, with the problem: how to clean up multiple interpreters, where a simple atexit() can't provide the necessary interpreter argument. 2 possible solutions are: a chained interpreter list structure keeping track of running interpreters, or an extra interpreter argument in internal_exceptions.


For now, I think I'd rather leak, as it is definitely killing the tinderbox.

This is was I did say above, just put comments around above statement if tinderboxen are the concern.

leo



Reply via email to