On 5/10/07, Lionel MARTIN <[EMAIL PROTECTED]> wrote:
I suspect that this is coming from data retrieved from my DB not being well
freed.

That's right.  There are two things you need to understand here.

The first is that Perl doesn't free memory from variables unless you
tell it to, even when they go out of scope.  This is an optimization,
and it works in your favor if you use the memory again.  You can free
the memory from a variable by undef'ing it, but that just frees it up
for Perl to use elsewhere in the current process.  (This is somewhat
operating system specific.  You may see processes shrink on some
systems after freeing memory, but not always.)

What this means for you is that you should never do things like read
an entire large file into a scalar, since that will permanently
increase the size of that apache process.  There's a lot of advice
about this here:
http://modperlbook.org/html/ch14_02.html

The second is that the MySQL client library will load the entire
result set into your process unless you tell it not to.  This is done
with the mysql_use_result option, discussed in the MySQL docs and also
here:
http://modperlbook.org/html/ch20_02.html

- Perrin

Reply via email to