perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lionel MARTIN" <>
Subject Re: After retrieving data from DB, the memory doesn't seem to be freed up
Date Fri, 11 May 2007 18:15:44 GMT
>> -another example hat comes to my mind is a project (implemented in  PHP) 
>> where I had to work. Part of the process was retrieving cached  HTML 
>> template pages from the server and do BB tags parsing before  serving the 
>> client. Of course, you would tell me that I could  retrieve the data 
>> chunk by chunk, but this is not as obvious, as  some BB tags could spread 
>> over several lines. So, this would need  to devise an algorithm to be 
>> sure we are not cutting in the middle  of a tag. In this kind of 
>> situation and if the file to be retrieved  don't grow too large, I would 
>> prefer to retrieve the file all at  once, do the processing, serve it to 
>> the client, and then, undef  the buffer. Far easier than doing chunk by 
>> chunk.
> Same thing: you'd presumably wrap that data in an object.


Basically, I would use an object here, containing why not a scalar member.
This way, when the reference to the object goes out of scope, the memory
associated to the object would be freed as well.
Finally, that's a devious way of doing what I was suggesting at the
beginning: use a lexical variable (a scalar) and undef it.

Wrapping that in an object would make the whole lot automatic (if I'm not


View raw message