Edit report at http://bugs.php.net/bug.php?id=52109&edit=1

 ID:               52109
 User updated by:  smacky86 at gmail dot com
 Reported by:      smacky86 at gmail dot com
 Summary:          session_start / session_write_close memory leak
-Status:           Feedback
+Status:           Open
 Type:             Bug
 Package:          Session related
 Operating System: Linux
 PHP Version:      5.3.2

 New Comment:

Now I was able to test this case with a fresh new setup, now really
v5.3.2 (the previous was 5.2.9, but I opend the ticket as 5.3.2).



The problem without Suhosin or any other extension doesn't appear, so
the first question is solved.

But I observed something: the header of the HTTP response contains a lot
of Set-Cookie line, one for each session_start() call.

I don't think it's the right way it should work.


Previous Comments:
------------------------------------------------------------------------
[2010-06-21 07:19:26] [email protected]

I forgot to include, did you try to disable the Zend allocator
(USE_ZEND_ALLOC)?

------------------------------------------------------------------------
[2010-06-21 07:07:56] [email protected]

We don't support PHP patched with 3rd party patches like Suhosin, what
is the results without, and what does valgrind give you? Should show if
there is a real leak

------------------------------------------------------------------------
[2010-06-17 15:49:23] smacky86 at gmail dot com

Description:
------------
session_start() and session_write_close() don't free unused memory. When
they are called multiple times, the memory usage reported by
memory_get_usage() constantly grows.



The session data is stored in files, ini settings are default.



# php -v

PHP 5.2.9 (cli) (built: Sep  1 2009 11:43:38)

Copyright (c) 1997-2009 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

    with Suhosin v0.9.31, Copyright (c) 2007-2010, by SektionEins GmbH



Test script:
---------------
session_start();

$_SESSION["foo"] = str_repeat("bar", 5000);

session_write_close();



$memory_before = round(memory_get_usage() / 1024, 2) . "KB";

for ($i=0; $i<1000; $i++)

{

  session_start();

  session_write_close();

}

$memory_after = round(memory_get_usage() / 1024, 2) . "KB";

echo "Before: " . $memory_before . "\n";

echo "After: " . $memory_after;

Expected result:
----------------
Before: 88.34KB

After: 88.34KB



(or something small amount)

Actual result:
--------------
Before: 88.34KB

After: 19906.61K


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52109&edit=1

Reply via email to