Message 1 of 6
Memory leaks in MEL

Not applicable
11-09-2012
12:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've run into a huge problem with just about every large MEL script I've written in the last couple of years. I tend to build tools in Maya to help me with tasks such as laying out navigation meshes in a game level or exporting vertex colors from hundreds of meshes to a binary file. When running these large MEL scripts, I always end up seeing Maya's memory usage expand as the script runs until eventually Maya runs out of memory and crashes. I was using the 32-bit version, but ended up having to go to the 64-bit version because these scripts eventually cause maya to grow beyond the 4GB limit. Well, even the 64-bit version isn't a big enough band-aid to fix this problem. Maya's currently at 9.4GB right now after having loaded 43,185 path nodes from 3.2 MB a binary file. Maya never releases the memory until it's quit and re-opened.
I really don't know where these memory leaks are coming from. I've tried and tried to debug my code in the past to find the sources but I always end up having leaks galore anyway. The most common culprit seemed to be not clearing arrays after using them, but I've been very careful to always do that. Also, I have the undo buffer disabled and am going to the extra effort to flush the buffer anyway. History is off as well. I'm out of ideas on where to look.
It's really becoming a productivity killer.
I really don't know where these memory leaks are coming from. I've tried and tried to debug my code in the past to find the sources but I always end up having leaks galore anyway. The most common culprit seemed to be not clearing arrays after using them, but I've been very careful to always do that. Also, I have the undo buffer disabled and am going to the extra effort to flush the buffer anyway. History is off as well. I'm out of ideas on where to look.
It's really becoming a productivity killer.