in reply to Centos 5 specific DBI memory leak

Call $sth->finish(); before your exit the subroutine.

Replies are listed 'Best First'.
Re^2: Centos 5 specific DBI memory leak
by Burak (Chaplain) on Aug 14, 2008 at 08:07 UTC
    Using finish() after fetching the values can be good but I don't think this is necessary here since all data is fetched and it must finish automatically.

    Btw, I seem to experience some weird behaviour with CentOS5 too, but since all perls are non-threaded I can't confirm this DBI issue...

    Update: on a second thought, I think the definiton of $sth can cause problems since it becomes a static var. I don't see any reason to define it outside the sub. So, it is better to define it inside the sub...
      Making $sth static is intentional.

      It allows to prepare() the statement only once, even if using it afterwards billions of times.

      Defining it in the sub would imply a heavy performance penalty, even if it would circumvent the problem faced now - but thank you anyway.

Re^2: Centos 5 specific DBI memory leak
by Krambambuli (Curate) on Aug 14, 2008 at 08:37 UTC
    I did that already, but I forgot to mention it; no difference seen.