[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: After retrieving data from DB, the memory doesn't seem to be freed up


On 5/11/07, Lionel MARTIN <suppressed> wrote:
For example, instead of using a "my $bigdata" in 50 different script, that
could this result in big memory allocation, I would use a unique
$mypack::bigdata in each script, so that each script would share the same
memory address for this potentially large  data.buffer.
I know it is not elegant, but this could help me save lots of memory.

It sounds pretty bad to me.  If you have a lot of scripts that, for
example, load large data files, make a module with a sub that you call
to load the files and use it from all your scripts.  Pass the data by
reference to the calling scripts.  Then you will isolate the large
lexical in that one module.

Better yet, don't load a large file into memory.

I tried to use "mysql_use_result" this morning, but without success.

There's probably just a syntax mistake in your script somewhere.  This
is what I use, to turn it on for specific statement handles:
my $sth = $dbh->prepare($sql, {mysql_use_result => 1});

- Perrin


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.