Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.6.0

Request #16646 memory leak
Submitted: 2009-09-26 09:35 UTC
From: osapon Assigned: avb
Status: Closed Package: HTTP_Request2 (version 0.4.1)
PHP Version: 5.2.5 OS: Linux
Roadmaps: 0.5.0    
Subscription  


 [2009-09-26 09:35 UTC] osapon (Yoshiyuki Osamura)
Description: ------------ I hope add destruct function in Request2.php. public function __destruct() { if ( isset( $this->adapter ) ) unset( $this->adapter ); } Test script: --------------- <?php require_once('HTTP/Request2.php'); for( $idx = 0; $idx < 10; $idx++ ) { fnc_get( 'http://www.yahoo.co.jp/' ); $memory_usage = memory_get_usage(); printf( "memory_usage::%s<br>\n", number_format( $memory_usage ) ); sleep(1); } function fnc_get( $url ) { $request = new HTTP_Request2( $url, HTTP_Request2::METHOD_GET); $request->setConfig( array( 'adapter' => 'curl', ) ); $response = $request->send(); //$request->__destruct(); // After function is added, it keeps effective. unset( $request ); } ?> Expected result: ---------------- memory_usage::189,328 memory_usage::189,600 memory_usage::189,600 memory_usage::189,600 memory_usage::189,600 memory_usage::189,600 memory_usage::189,600 memory_usage::189,600 memory_usage::189,600 memory_usage::189,600 Actual result: -------------- memory_usage::233,280 memory_usage::277,832 memory_usage::322,040 memory_usage::366,272 memory_usage::410,488 memory_usage::454,720 memory_usage::498,960 memory_usage::543,208 memory_usage::587,568 memory_usage::631,928

Comments

 [2009-09-26 14:27 UTC] avb (Alexey Borzov)
-Status: Open +Status: Assigned -Assigned To: +Assigned To: avb -Roadmap Versions: +Roadmap Versions: 0.5.0
 [2009-11-14 19:31 UTC] avb (Alexey Borzov)
-Status: Assigned +Status: Closed
Fixed in SVN, I used a different approach: I now remove reference to HTTP_Request2 object from Adapter on completing the request. This seems to help here, please reopen this report if it doesn't help in your case.