Scott Reames wrote:
> I am wondering if anyone has noticed a memory leak in sth->execute with
> 2.9003? Given the simple test code below, as soon as sth->execute is
> called, memory usage on the machine skyrockets to well over 500M before
> the fetch loop even begins.
You have to be aware, that the C driver (that is the software layer
on which the Perl driver sits) is most probably loading the *whole*
result set into memory. If the result set is 500M big, it will take
500M. That's not a memory leak. It is your task to reduce the size
of the result set.
In MySQL 5.0 you would use server side cursors for that. In MySQL 4.1
or lower you need client side cursoring (multiple queries with LIMIT
clause) or set the flag "mysql_use_result". See "perldoc DBD::mysql".
Be aware of the side effects.