Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
clearAllReferences() not working?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
David Ordal  
View profile  
 More options Jul 31 2012, 2:14 pm
From: David Ordal <da...@ordal.com>
Date: Tue, 31 Jul 2012 11:14:00 -0700 (PDT)
Subject: clearAllReferences() not working?

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
William Durand  
View profile  
 More options Aug 1 2012, 2:55 am
From: William Durand <william.dura...@gmail.com>
Date: Wed, 1 Aug 2012 08:55:22 +0200
Local: Wed, Aug 1 2012 2:55 am
Subject: Re: [propel] clearAllReferences() not working?

Heya David,

Quick reply, did you see this project:
https://github.com/tentacode/PropelLeaks?
It's about Propel leaks (not because of Propel itself most of the time ;)),
but it provides useful tips to avoid leaks.

Cheers,
William

2012/7/31 David Ordal <da...@ordal.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Kleiner  
View profile  
 More options Aug 1 2012, 6:18 pm
From: Peter Kleiner <runtfa...@gmail.com>
Date: Wed, 1 Aug 2012 18:18:58 -0400
Local: Wed, Aug 1 2012 6:18 pm
Subject: Re: [propel] clearAllReferences() not working?

David,

Try putting this ahead of your loop and see what happens:
Propel::disableInstancePooling();

Pete Kleiner


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Ordal  
View profile  
 More options Aug 4 2012, 4:39 am
From: David Ordal <da...@ordal.com>
Date: Sat, 4 Aug 2012 01:39:24 -0700 (PDT)
Local: Sat, Aug 4 2012 4:39 am
Subject: Re: [propel] clearAllReferences() not working?

Pete-

You're awesome; Propel::disableInstancePooling() did it! It looks like
memory is holding stable now.

Looking through the code, appears that Propel caches every object it gets
back from the database, even if you clear it. And disabling instance
pooling turns that off. I can't see any downside, save for a few functions
that apparently need it turned on and throw an exception if its not. But
let me know if I'm wrong on that.

For the record, I removed the clearAllReferences() calls after turning this
on, and memory is fine. So PHP 5.3's garbage collection must be working OK.

D


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »