When do different scopes get removed from memory?

Hi,
Here's what I've got.  I have a cfc that processes complex xml documents for product catalogs.  We've got functions in that cfc to process various parts of each document, with parts being passed to the function (product object struct, option struct, etc) in loops.
It would work fine for small docs, but as the documents got bigger, the process would slow, and as we approached 3-6 mb it would grind to a halt and after 4-9 mb, we'd get heap space errors.  Memory was just being consumed violently. 
All that was happening though is we do an xml search to get an array of products/options/media etc.  We'd loop that array passing in the option or whatever.  The function it was passed to just loaded the orm objects up and saved them, flushing and clearing the session at the end.
One thing I noticed trying to figure out what was going wrong was that even though is if we force kill the server half way through the for loop, we get a hundred or so errors that there's variables, but no ORM.  Makes me think that even though we had items being passed through arguments and then all variables in the functions being var scoped, variables are still hanging in memory attached to the sessions. 
Which makes me ask the question, when do variables in each scope get marked for garbage collection and will var scoped/argument scoped variables hang through the entire request?
I found the best/only solution to my problem was to create a variable scoped argument to use as an accessor for the product/option/media object between the loop and the method doing the work.  When I changed to not passing it as an argument, my memory consumption went up initially, but then held at the same level and my logic started to proceed at a constant rate.
Thanks,
Joel

I wish I could go that simple.  But we're using Coldbox, so there's a lot more being put into variables scope than what I'm using.  Also, it seems to be narrowing down to orm calls. 
We've got a pretty basic bit of logic, as it loops through an xml file over say elements that represent options for a product, we use the ormExecute to find if the object exists, if it doesn't, create a new one, set some more variables, save and flush the orm.  That's really all it comes down to. 
I'd turned on logging the gc to console and we can watch as each method runs to push an element into the orm the memory used grows.  Even with doing a forced gc, we see it keep growing.  Even tried commenting out all code except for a single ormExecute to get the object if it exists and that part still kept making the memory grow. 
Which makes me wonder if there's something in CF orm that caches, but doesn't get cleared on a flush.  We don't have the orm cache turned on though, so it isn't making a lot of sense yet.

Similar Messages

  • How InDesign comes to know about any changes on document, but not saved. As it shows * on the name of document when it is opened and any changes. And after saving * symbol is get removed from the name of document. How and where indesign@ handles this?

    How InDesign comes to know about any changes on document, but not saved. As it shows * on the name of document when it is opened and any changes.
    And after saving * symbol is get removed from the name of document. How and where indesign@ handles this?

    Are you just asking because you want to know, or do you have a problem you need to solve? I don't know how to write a program, but I think what your are describing is not an unusual thing for a  program to do. The * tells you that changes have been made since the last save, and the program reserves a portion of memory for undo functions. I suppose a coder could tell you how it works, but I don't think it would help an average user to know, but that's just my opinion.

  • When and how does the message context get removed from the message when we use pass thru send port

    Friends,
    i have a doubt regarding message context.
    Assume i have used XMLRecieve pipeline in the receive side to receive the message so that the message context is created. I.e properties are promoted/written.
    now if we use pass thru transmit pipe line at send side, how and when does the message context get removed from the message?? Since pass thru does not have any stages/components, how does the message context removed and sent out a pure message to destination???
     i mean what exactly happens here to remove the context??
    Ravindar

    Thanks for the reply.
    "The Context is created by the Adapter, regardless of any Pipeline or Pipeline Component.  It has nothing to do with PassThrough vs. XmlReceive, although XmlReceive will write Promoted Properties to the existing Context,
    as can any other Component."
    yeah yeah, adapter does create some properties in context. You are right, i am aware of it. I just missed to explain it clearly. what i meant is addition of context properties will not happen if pass thru used. Thanks its clear.
    "No.  The Context already exists on the Message when it comes from the MessageBox and
    is equally available to any Component in any Stage.  The Context that hits the Pipeline is whatever was last Persisted, either by a Receive Port or Orchestration.  It is not created by the XmlAssembler (XmlTransmit)"
    You are right , the context already exists on the message while it leaves the receive port, and once it persists
    to message box the context and message context gets stored in messages in relative tables.
    Now as you said the components get the message from the last persistence, assume i have a send port(with passthru)
    subscriber and a orchestration subsrciber for this message.
    Orchestration gets the message with context right!!
    if the send sendport(with passthru) also gets message along with context, then where is this context removed/demoted
    while sending it out?.  i guess as per SAAkhlaq said,
    here sendport(with passthru) should get a pure message without context as passthru used. 
    or is it that ultimately send adapter removes the context completely?
    or is it something like biztalk run time load the context from database into cache and both orchestration and send port gets pure message, and if needed they use context from cache???
    sorry i may be troubling you, but i am confused. i hope i am not creating any nuisance with this
    post.
    Ravindar

  • When i restore my backup from computer why do my minutes texts and data gets removed from my pay as you go sim card

    when i restore my backup from computer why do my minutes texts and data gets removed from my pay as you go sim card?

    As long as it's unlocked it will work with any SIM, incl. EE SIMs.
    If you buy abroad you need to ensure it is compatible with UK mobile frequencies, on which I cannot advise.

  • If I press "Erase all contents and settings" does the iCloud account get removed from the iPhone?

    If I press "Erase all contents and settings" does the iCloud account get removed from the iPhone?
    I also do not know the password to the iCloud account and when I go to the "Forgotten Password" link, it says that account is not found.

    Yes, but you will not be able to erase it without the password if Find My iPhone is turned on.  If you need to reset your iCloud password, read here: http://support.apple.com/kb/PH2617.  Of course, you can't reset the password unless it is your iCloud ID.

  • Help me Please.. I can log on to the Apple website to manage my account and all the information is correct, but I get "Your Apple ID has been disabled" when I try to get something from App Store on my iPad

    Help me Please.. I can log on to the Apple website to manage my account and all the information is correct, but I get “Your Apple ID has been disabled” when I try to get something from App Store on my iPad3
    I'm from poland.
    Thx
    Balbi

    Contact iTunes Customer Service and request assistance...
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • I can log on to the Apple website to manage my account and all the information is correct, but I get "Your Apple ID has been disabled" when I try to get something from App Store on my iPhone.

    I can log on to the Apple website to manage my account and all the information is correct, but I get “Your Apple ID has been disabled” when I try to get something from App Store on my iPhone.

    You need to contact Apple Support, particularly iTunes Store support team.  Cheers!

  • HT204266 My new iPad, when I try to get something from the Apple Store it tells me that My account isnot vlaid for use inthe U.S.store.  And to switch to the Australian store before purchasing, how do I do this?

    My new iPad, when I try to get something from the Apple Store it tells me that My account i snot vlaid for use in the U.S.store.  And to switch to the Australian store before purchasing, how do I do this?  I am in Australia?

    There are instructions on this page for creating an account without a credit card : http://support.apple.com/kb/HT2534
    You can download a copy of the iPad manual from here : http://support.apple.com/manuals/ipad/

  • I have an app in my App Store under updates under purchased that I'd like to get removed from my phone. How do I do that?

    I have an app in my App Store under updates under purchased that I'd like to get removed from my phone. How do I do that?

    In the Home screen, tap and hold the app until it wiggles. Then tap the minus red icon placed in the top of the icon. Deleted

  • [svn:fx-trunk] 5839: * Removed the logic that tracked when cached SWC had been removed from

    Revision: 5839
    Author: [email protected]
    Date: 2009-04-01 10:34:31 -0700 (Wed, 01 Apr 2009)
    Log Message:
    * Removed the logic that tracked when cached SWC had been removed from
    the library path, because it wasn't working correctly in some cases
    and it is no longer necessary due to revision 5524.
    tests Passed: checkintests, performance testsuite, FlexBuilder
    outputFolder JUnit tests
    Needs QA: YES
    Needs DOC: NO
    API Change: NO
    Reviewer: Pete F.
    Code-level description of changes:
    CompilerSwcContext.java
    Removed updateRemovedSources() and it's usage.
    CompilerAPI.java
    Removed deleteRemovedSwcSources(), renamed
    deleteObsoletedSwcSources() to reportObsoletedSwcSources(), and
    deleteShadowedSwcSources() to reportShadowedSwcSources().
    Updated validateCompilationUnits() to no longer report
    DependentFileNoLongerExists.
    SwcCache.java
    Removed "removed" and "updated" variables, their getters, and the
    code that initialized them.
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilerAPI.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilerSwcContext.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcCache.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcGroup.java

    Revision: 5839
    Author: [email protected]
    Date: 2009-04-01 10:34:31 -0700 (Wed, 01 Apr 2009)
    Log Message:
    * Removed the logic that tracked when cached SWC had been removed from
    the library path, because it wasn't working correctly in some cases
    and it is no longer necessary due to revision 5524.
    tests Passed: checkintests, performance testsuite, FlexBuilder
    outputFolder JUnit tests
    Needs QA: YES
    Needs DOC: NO
    API Change: NO
    Reviewer: Pete F.
    Code-level description of changes:
    CompilerSwcContext.java
    Removed updateRemovedSources() and it's usage.
    CompilerAPI.java
    Removed deleteRemovedSwcSources(), renamed
    deleteObsoletedSwcSources() to reportObsoletedSwcSources(), and
    deleteShadowedSwcSources() to reportShadowedSwcSources().
    Updated validateCompilationUnits() to no longer report
    DependentFileNoLongerExists.
    SwcCache.java
    Removed "removed" and "updated" variables, their getters, and the
    code that initialized them.
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilerAPI.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilerSwcContext.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcCache.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcGroup.java

  • Did Russell Brown's Adobe Paper Textures Pro (extension) get removed from Photoshop CC (2014.2)  October release?

    Did Russell Brown's Adobe Paper Textures Pro (extension) get removed from Photoshop CC (2014.2)  October release?

    I was just about to make a comment on the Discussions page.   I believe that the reason I couldn’t get Paper Textures to work in PS CC (2014.2) is because all (2014) versions of PS are HTML based not Flash based.
    Adobe should have called Photoshop CC (2014)     Photoshop CC (HTML)  so we would remember that switch over in their core coding.
    Now I have to got to Russell’s script site and get Paper Textures 3.1.0.
    Thanks for helping.

  • HT204053 why my apple id was disable when i try to get apps from app store

    why my apple id show disable when i try to get apps from app store???

    These are user-to-user forums, nobody on here will know why it's disabled. You might be able to re-enable it via this page : http://appleid.apple.com, then 'reset your password'
    Or you might need to contact Apple : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page
    If it then works on your computer's iTunes but not your phone then try logging out of your account on the phone by tapping on the id in Settings > iTunes & App Stores and then log back in and see if that 'refreshes' the account on it

  • Contact groups. My contacts get removed from the groups, not from All Contacts. I don't know why this happens. Anyone know why?

    Sometimes the contacts in certain groups are removed and the group is empty.  They do not get deleted, and are still in All Contacts, just get removed from the group.  Then I have to start all over again and add contacts to the groups.  This seems to happen randomly and I don't know why it does.  My contacts are synced with my Yahoo contacts.  I don't know if thats why.  Does this happen to anyone else?

    Thank You, thank You ...so much......that feature made me crazy!  
    Ocean20 wrote:
    This can be turned off in settings/accessibility/zoom. Then on the next screen turn off

  • Is it possible to know when the sim card was removed from iPhone after been stolen?

    My iphone got stolen and I could see that my ipad got trouble with itunes and icloud. Is it possible to know when the sim card was removed from iphone?

    no,

  • Does all my music stay on my MacBook Pro after I sign up for iTunes Match, or does it get removed from my Mac?

    Does all my music stay on my MacBook Pro after I sign up for iTunes Match, or does it get removed from my Mac?

    Hi,
    It remains on your hard drive. iTunes match scans your library to determine if tracks are matched or uploaded. It does not touch the files on your hard drive. You have the option to upgrade tracks for matched versions but you need to delete tracks and download new versions.
    You can camn opt to delete tracks from your library. This will free up space and you will be able to stream your music. In any event, I suggest that you back up your music to an external drive.
    jim

Maybe you are looking for