second run of my program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jenya56
    New Member
    • Nov 2009
    • 14

    second run of my program

    I have a very large object. When I run my program first time it runs just fine. But if I want to re-run it it fails by saying that it is out of memory. Any suggestions? Perhaps, should I call destractor (sp?) after I am done working with my object and need to run my program the second time. I am not sure how to do it. Perhaps, is there a function in python that clears all the memory? Thanks.
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    It's hard to say without seeing your code. Python performs a garbage collection when an object's reference count reaches 0. An object's reference count is decreased whenever a it goes out of scope or is reassigned. It also can be decreased by the del statement. You should not have a problem like this.

    Comment

    • Glenton
      Recognized Expert Contributor
      • Nov 2008
      • 391

      #3
      Yeah, I agree. Most often a little bit of care will sort out any problems. A bit more sense of the code, perhaps a minimum working example or something. Python doesn't keep track of your RAM, so if your object gets too big, then tough luck! But, as I say, with care this is almost never a problem. Eg do you need the whole lot in RAM? Anyway, it's hard to know without seeing the object in question.

      Also, what operating system and how much RAM etc might be helpful, if you think this is really the issue.

      Comment

      Working...