Bug #55739 [Opn->Nab]: possibility memory leak on namespace and spl_autoload_register

From: Date: Sat, 17 Dec 2016 15:22:00 +0000
Subject: Bug #55739 [Opn->Nab]: possibility memory leak on namespace and spl_autoload_register
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206099@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55739&edit=1 ID: 55739 Updated by: nikic@php.net Reported by: support at freelancecode dot cz dot cc Summary: possibility memory leak on namespace and spl_autoload_register -Status: Open +Status: Not a bug Type: Bug Package: Performance problem Operating System: Ubuntu Natty Nerwhal PHP Version: 5.3SVN-2011-09-20 (snap) Block user comment: N Private report: N New Comment: Very unlikely to be a leak, given the numbers mentioned (1KB differences are noise). Previous Comments: ------------------------------------------------------------------------ [2011-09-20 12:39:47] support at freelancecode dot cz dot cc Description: ------------ Hi, I want to report (possible) bug that related to namespace and spl_autoload_register. Somehow, I cannot reclaim memory used (using unset) if I am using namespace WITH include(_once) or require(_once) (on multiple page call) compared than using multiple namespace on single page alone. I do not know if it is a bug or perfomance issue. I met the same case on spl_autoload_register. I compared using include(_once) or require(_once) against spl_autoload_register, and found the resource (memory usage) cannot be claimed. so, that's all. Test script: --------------- namespace Abstraction; $start = microtime('time'); $mem = memory_get_usage(); /* * Untuk sementara, penggunaan namespace TIDAK BOLEH MENGIKUTSERTAKAN include dan require, * karena hal seperti ini menggunakan memory resource sangat tinggi. Hal ini sepertinya adalah bug (memory leak). * Kejadian serupa juga dapat ditemui pada penggunaan spl_autoload_register. */ abstract class RequestAbstract { abstract public function server($key); } class RequestImpl {} class NamespaceAbstract {} namespace Http; use \Abstraction; class MyRequest extends Abstraction\RequestAbstract { public function server($key = '') { return new Request; } } class RequestConcrete extends Abstraction\RequestImpl {} class Response {} $test3 = new Response; $test4 = new MyRequest; $test5 = new RequestConcrete; $test6 = new Abstraction\RequestImpl; $test7 = new Abstraction\NamespaceAbstract; print_r($test3); print_r($test4); print_r($test5); print_r($test6); print_r($test7); unset($test, $test3, $test4, $test5,$test6, $test7); echo "Elapsed: ", microtime('time') - $start, " Memory Usage: ", memory_get_usage() - $mem; // give result only consumed 156 bytes (compared than using include or require) Expected result: ---------------- Test script on singlepage namespace: // give result only consumed 156 bytes (compared than using include or require) Test script on multiplepage namespae: Expected: 156 bytes Actual result: -------------- Test script on singlepage namespace: // give result only consumed 156 bytes (compared than using include or require) Test script on multiplepage namespae: Actual: 1 KB (more or less) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55739&edit=1

« previous php.bugs (#206099) next »