Share » Forums » Developer » resetDataMap and...

resetDataMap and eZContentObject::clearCache

resetDataMap and eZContentObject::clearCache

Wednesday 02 February 2011 9:21:19 am - 4 replies

Author Message

Damien Pobel

Thursday 03 February 2011 1:06:44 pm

Hi Marko,

AFAIK, eZContentObject::clearCache() is usually enough to circumvent memory issues in CLI scripts because it clears a cache that stores all content objects in memory while eZContentObject::resetData() only clears the data map of the object that can be quite small and should be cleared by clearCache() anyway.

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Jérôme Vieilledent

Friday 04 February 2011 12:43:59 am

Hello Marko and Damien

I already had memory issues using only eZContentObject::clearCache(). Normally it would indeed clear all the circular references to the object, it actually doesn't. I don't know why, maybe a PHP issue but anyway, the best way to avoid memory leaks is to use both eZContentObject::clearCache() and eZContentObject::resetDataMap().

Here you can find an example in SQLIImport content framework (loot at the flush() method, call by the destructor) :

Damien Pobel

Friday 04 February 2011 1:27:22 am

Hi,

I guess you encountered those problems with PHP 5.2 ? PHP 5.3 solves a lot of problem in memory management.

Anyway,there's no problem in calling both resetDataMap() and clearCache() methods in a CLI scripts.

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Jérôme Vieilledent

Friday 04 February 2011 2:22:35 am

Yes, it was with PHP 5.2.x

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu