The attached patch fixes the problem. It changes Scratchpad's data pointer to be a pointer to an array of Parrot_Lexicals (rather than an array of pointers to Parrot_Lexicals). The (name and value) lists are shared but never the actual Parrot_Lexical ptr. So no more leak.
Patch touches: -- classes/scratchpad.pmc -- sub.c -- t/pmc/scratchpad.t (adds a test) -- Jonathan Sillito > -----Original Message----- > From: Jonathan Sillito [mailto:[EMAIL PROTECTED]] > > > -----Original Message----- > > From: Leopold Toetsch [mailto:[EMAIL PROTECTED]] > > > > Further remark: the scratchpad clone code looks dubious, the 2 lists in > > the data (lex) entry should probably cloned too - and at least the lex > > ptrs themselves. > > The destroy method leaks, because we can't cleanup duplicated lex ptrs. > > > > Can somone better knowing scratchpads comment on this please. > > > > I guess there is a related problem with the way the function > scratchpad new > works, since it needs to copy lex ptrs from enclosing scopes? > > I will look into it more in a bit ... >
scratchpad_leak.patch
Description: Binary data