PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #6458

staticGet cache is never cleared

Details

Submitted2006-01-10 20:56 UTC
Fromkevinrsours at yahoo dot com
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.4.1
OSBSD 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.