php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8931 Memory leaks attributable to OO PHP
Submitted: 2001-01-26 06:32 UTC Modified: 2002-01-02 13:52 UTC
From: Jason at hspace dot net Assigned:
Status: Closed Package: Performance problem
PHP Version: 4.0.4pl1 OS: Windows 2000
Private report: No CVE-ID: None
 [2001-01-26 06:32 UTC] Jason at hspace dot net
I wrote two scripts to compare the difference in performance between simple script and one written in OO with classes and required libraries. Both scripts accessed the SQL database using ADODB connection. I used Microsoft Web Application Stress Tool, which seems to be very useful.
The "simple" version yielded better performance in less CPU usage (and no memory leaking), whereas the OO version maxed out the CPU usage 100%, as well as slowly but surely leaking memory.
I tried using the unset() function in several places in the code, but this did not help much, as the script was still leaking memory during the tests.

Using unset() to unset the COM object helped a lot, as PHP did not seem able to free the memory by itself.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-26 06:38 UTC] Jason at hspace dot net
The short version scored 7680 hits over 2 min, whereas the Object Oriented version scored around 1700 hits over 2 min running 4 threads.

Both scripts do the same thing, query to database, with same result, but the OO version seems to be 5 times slower, so I am classifying this bug as a performance problem.
 [2001-01-26 06:56 UTC] Jason at hspace dot net
I've identified the problem as PHP leaking memory when it sees code that it doesn't like, eg. it leaks code when the script crashes with an error. I think that it leaks code even when it reads through functions and there is code in them which it does not recognise (that it will give an error, but ... because the function is not run, the script does not report an error, but memory is leaked anyway).
 [2001-12-12 18:46 UTC] yohgaki@php.net
Could you try 4.1.0 see if it help?
 [2002-01-02 13:52 UTC] lobbin@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC