TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Memory leak DB::query() ?
  • So I used a bunch of
    DB::query(NULL, "Replace into ....");
    statements and my script used up all of the maximum php memory limit of 128MB after about 60,000 rows (I could watch the usage grow in 'top' and had an error message in the logs).

    Using mysql_query() for the same query did not do anything - mem usage did not increase (the apache worker stayed at all times below 100MB) and about 107,000 rows were processed in total.

    This was a batch job and did not output anything, in case you wonder if it might have been a flushing issue.
    Should we be concerned?
  • Try disabling profiling in your database config. It should reduce the memory used.
  • I just ran some tests to be sure, but as @Isaiah said, setting "profiling" to FALSE in your database config will keep the memory usage 100% stable.
  • Thanks, so this is the culprit!
  • Possibly database profiling should be off by default, a few people have spent lots of time trying to identify where the leak is coming from.

    It makes more sense to have to enable it if you want to profile the database rather than on by default.

  • It's been removed completely in 3.3 iirc, and consolidated into the main profiling config.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion