| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2010-04-24 18:43 UTC] felipe@php.net
  [2010-05-02 16:24 UTC] cbandy at jbandy dot com
  [2010-05-04 11:48 UTC] shooreek at gmail dot com
  [2010-05-07 13:19 UTC] shooreek at gmail dot com
 
-Package: Scripting Engine problem
+Package: SQLite related
  [2010-05-07 13:19 UTC] shooreek at gmail dot com
  [2010-05-07 16:51 UTC] crrodriguez at opensuse dot org
  [2010-05-08 11:22 UTC] shooreek at gmail dot com
  [2010-05-25 15:29 UTC] shooreek at gmail dot com
  [2010-09-20 14:47 UTC] iliaa@php.net
 
-Status: Open
+Status: Bogus
  [2010-09-20 14:47 UTC] iliaa@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 09:00:01 2025 UTC | 
Description: ------------ Run PHP script with infinite loop from command line. Call each loop database function from extension (I tested SQLite and Mysqli). Open task manager. You will see that memory use is growing up, while PHP function memory_get_usege() reports that memory usage is constant. The memory usage may grow up to 1,5Gb or even more (depends on script code size), even if memory_limit is set to 8Mb. How is this possible?! Test script: --------------- <?php $dbfile = 'mysqlitedb.db'; if(file_exists($dbfile)) unlink($dbfile); $db = new SQLite3($dbfile); $db->exec('CREATE TABLE foo (id INTEGER, bar varchar(30))'); $db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')"); $i=0; while(1) { $i++; $db->exec("INSERT INTO foo (id, bar) VALUES ($i, 'This is a test')"); $db->exec("UPDATE foo SET bar='This is memory leak' WHERE id=$i"); echo "$i ".memory_get_usage()." ".memory_get_usage(true)."\r"; } ?> Expected result: ---------------- Constant memory usage. Actual result: -------------- Memory usage grown up (script output): iteration, memory_get_usage(), memory_get_usage(true), memory usage(from taskmgr), virtual memory usage(from taskmgr) 2131 330384 524288 - 1068Kb 5356Kb 4661 330384 524288 - 1148Kb 5440Kb 10974 330384 524288 - 1336Kb 5652Kb 24985 330384 524288 - 1824Kb 6140Kb 43894 330384 524288 - 2516Kb 6828Kb As you can see, memory usage is not constant. Why?!