On Wednesday, August 1, 2012 3:18:58 PM UTC-7, Peter Kleiner wrote:
> David,
> Try putting this ahead of your loop and see what happens:
> Propel::disableInstancePooling();
> Pete Kleiner
> On Tuesday, July 31, 2012, David Ordal wrote:
>> I'm trying to troubleshoot a memory leak in Propel. I have a script that
>> basically iterates over a bunch of data to create models and save them to
>> the DB. The key part is like this:
>> $result = // web service query to get an array of data
>> foreach ($result as $entry) {
>> Module_Console::printMessage("Memory Before Insert Holding:
>> ".memory_get_usage());
>> $holding = new Model_Holding();
>> $holding->setFilingId($entry->getId());
>> $holding->setStock($entry->stock_id);
>> $holding->setSharesHeld($entry->shares);
>> $holding->save();
>> Module_Console::printMessage("Memory Before Clear References:
>> ".memory_get_usage());
>> $holding->clearAllReferences(true);
>> unset($holding);
>> Module_Console::printMessage("Memory After Clear References:
>> ".memory_get_usage());
>> }
>> The problem is that the memory is going up no matter what I do:
>> Memory Before Insert Holding: 35967864
>> Memory Before Clear References: 35970744
>> Memory After Clear References: 35970840
>> So even the act of clearing the object is increasing memory usage! If I
>> get rid of that clearAllReferences() call, I see memory holding steady, but
>> not getting freed up with the unset() like I'd expect:
>> Memory Before Insert Holding: 35791064
>> Memory Before Clear References: 35793944
>> Memory After Clear References: 35793944 // without
>> clearAllReferences() call; just the unset()
>> So I'm not sure what's going on; somewhere Propel must be holding onto a
>> reference for every object I create, which is why even unset() isn't
>> working?
>> Any thoughts on what to look for or where to go from here?
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Propel Users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/propel-users/-/a3EHEP6s-44J.
>> To post to this group, send email to propel-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> propel-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/propel-users?hl=en.