×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Python scripting memory leak

Python scripting memory leak

Python scripting memory leak

(OP)
I wrote a script to propagate cracks through material and I found a peculiar memory leak.

For instance I delete existing seams like this:

    for e in aPart.edges:
        mModel.rootAssembly.engineeringFeatures.
        deleteSeam(regions=regionToolset.Region(
        edges=aPart.edges.findAt((e.pointOn[0], ))))

But this puny codepiece causes .cae file to grow ~50 KB whenever executed.
After 100 extensions .cae grows to a few MB irreversibly - I deleted parts, assembly, cracks (basicaly everything that is deletable througs ABAQUS GUI) saved it under a new name and still ended up with this huge .cae.
I use ABAQUS 6.6-1

RE: Python scripting memory leak

I had the same problem. I have not found any solution yet...better than restarting ABAQUS.

The interesting part is than under v6.4 this problem did not occur. I could run the same model generation script repeatedly without any memory leak.

Also, in v6.5 when generating 2D parts with holes, CAE takes a huge amount of memory for no reason, but this does not happen in 6.6.

I think the problem is objects remain referenced internally by CAE, for some reason, and the occupied memory cannot be collected.  

RE: Python scripting memory leak

Did you try a save-as?

The way the cae database is architected is such that deleting objects does not necessarily free the memory allocated in the database for those objects - it just marks those objects as "deleted" and they are no longer referenced by anything. (This is the same behavior as a lot of databases e.g. Microsoft Office pst files - and the reason why they provide a "compact now" facility)

Anyway, doing a save as only copies the "live" objects, so the resulting .cae file will be much smaller.

RE: Python scripting memory leak

(OP)
save-as doesn't work either

RE: Python scripting memory leak

In Python, if an object is no longer referenced by anything, then the garbage collector will try to free the memory.

Probably, the objects defining the model still remain referenced in CAE internally, even after using "del object_reference", and therefore the memory cannot be freed.


RE: Python scripting memory leak

    In our work with Python-ABAQUS interface I found Python never returning memory to the operating system. For instance, if you write a python program realized an iteration process and you expect to run it for a long time then it's total allocated memory will reach a peak and pretty much stay there, no matter what you do.
    This is known issue and there is a patch under development to try and fix this problem in Python 2.5.
    One way to possible workaround is to run python as separate child process for one iteration and kill sometimes it to free memory to the operating system.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources