|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2016-12-17 15:21 UTC] nikic@php.net
 
-Status: Open
+Status: Not a bug
  [2016-12-17 15:21 UTC] nikic@php.net
 | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 17:00:02 2025 UTC | 
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)