php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49711 Memory Leak in Deprecated Methods ZEND_ACC_DEPRECATED
Submitted: 2009-09-29 14:49 UTC Modified: 2009-10-06 14:07 UTC
From: kristina at 10gen dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3, 6 (2009-10-01) OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kristina at 10gen dot com
New email:
PHP Version: OS:

 

 [2009-09-29 14:49 UTC] kristina at 10gen dot com
Description:
------------
A method with the ZEND_ACC_DEPRECATED flag will cause memory usage to increase each time it's called through PHPUnit.  (It doesn't occur with a PHP program run with "php script.php", so it might have something to do with reflection.)

It occurs in 5.2.* and 5.3.*, only on Windows.  

I've written a small PHP extension that demonstrates this bug.  It is available at http://github.com/beaddy1238/PHP-Memleak.

Reproduce code:
---------------
Compile the extension by putting the config.w32, php_mongo.h, and mongo.c files in a pecl\mongo dir.

From the pecl\mongo directory, run:

phpunit tests\MongoRunner.php

It print out the memory used at the beginning and end of the function.  The function calls Mongo->lastError() (an empty method) 10000 times.

Expected result:
----------------
I expect the memory usage to stay the same.  

Actual result:
--------------
The more times Mongo->lastError is called, the more memory is used.

This stops happening if ZEND_ACC_DEPRECATED is removed from mongo.c.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-29 15:14 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-09-29 16:11 UTC] kristina at 10gen dot com
It segfaulted immediately, popping up the Visual Studio Just-In-Time debugger window before outputting anything.
 [2009-09-29 17:23 UTC] kristina at 10gen dot com
Okay, my bad.  Fixed the extension.  It prints:

3670016
10223616

(The first number is mem usage before running the function 10000 times, the second the mem usage after).
 [2009-10-06 14:07 UTC] kristina at 10gen dot com
Continued digging and found that PHPUnit is saving all the deprecated warnings in an array.  Sorry for the trouble.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 08:00:03 2025 UTC