Re: Re: Doubts from leaks...

David Hakim <dhakim-Gkm/TONP9n1Wk0Htik3J/[email protected]> Fri, 2 May 2003 10:54:23 -0400
Newsgroups gmane.comp.lang.moto.devel
Message-ID <[email protected]>
On Friday, May 2, 2003, at 11:13  AM, Stefano Corsi wrote:

>>> track down allocated memory, without the need to free it. But then, 
>>> in
>>> a big
>>> nested loop, the use of a lot of moto_strdup created lots of 
>>> problems.
>>> So I'm
>>> unsure, now...
>>
>> The shared heap memory allocated by moto_strdup gets recorded in an
>> mpool which doesn't get freed until the end of page execution.
>
> Uhm. I wonder if we could implement a counter in motoi_for, to free 
> the pool
> every nth call...

We cannot do this because most everything allocated by the interpreter 
is tracked in that pool. The reason memory is generally tracked in this 
pool is that we are not sure we can safely free it until the page is 
done executing. The case of createMotoname calling moto_strdup actually 
sounds like a bug to me because I believe in general that memory does 
not need to persist after the function is looked up.

-Dave

> Stefano
>