Calling HEAP_FREE Crashes IDL

QUESTION: I'm struggling with an IDL fatal error after calling Heap_Free. The argument is a rather complex structure (hence the use of Heap_Free). I started using Ptr_Free on some of the fields before the Heap_Free call, but no luck so far (the structure is complex, so maybe I missed some). I'm working on a WinXP 64-bit machine, but I also tried a WinXP 32-bit machine with the same result. Any ideas?

ANSWER: Today's answer is supplied by a technical support person at ITTVIS.

This problem is due to a stack overflow in the code that cleans up the heap. I submitted a fix and it should show up in a future version. A quick band-aid until then is to increase the stack size for IDL. On UNIX systems, that's usually done with the "ulimit" command. On Windows, I think you can do it with "editbin.exe". Here is a webpage with more detail on how to increase the stack size.

Unfortunately, this work around isn't a complete fix. You can still run into this problem, but it will take a much larger object to hit it. On OS X, setting the stack size to the maximum let me run the user's code with n=149000L.

Version of IDL used to prepare this article: IDL 7.0.3.

Google
 
Web Coyote's Guide to IDL Programming