Home » Database » DB_DataObject » Bug #6458
staticGet cache is never cleared
Details
| Submitted | 2006-01-10 20:56 UTC |
|---|---|
| From | kevinrsours at yahoo dot com |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 4.4.1 |
| OS | BSD Unix |
| Roadmaps | (Not assigned) |
Comments
[2006-01-10 20:56 UTC] kevinrsours at yahoo dot com
Description:
------------
When staticGet is called, a copy of the created object is stored in a cache. If a script calls staticGet repeatedly, then the memory usage can be considerable. This cache is never cleared and there is apparently no way to clear it (without calling private functions). Freeing the object doesn't help.
(Note, DB_DataObject::staticGet is listed as deprecated, but the child class version is not -- this may just be a documentation oversight, since the child class falls back directly to the deprecated function)
Test script:
---------------
for($i; $i < 1000; $i++) {
$foo = DataObjects_Foo::staticGet($i);
$foo->free();
}
Expected result:
----------------
Should not see 1000 copies of foo in the cache. Either need better cache hanlding or the object needs to be removed when freed (or some other cache clearing mechanism provided)
Actual result:
--------------
Either a memory allocation error or substantial extra memory usage.