Hello all,
I am getting a memory error and have been unable to fix it thus far.
When I run my script on a batch of 360 files (asking it to load in 360 .max files, perform some operations on them, calculate a number of values for each file and write these values to a number of text files) the RAM usage quickly rises to 100% and after a certain amount of files have been processed windows gives me a message saying 'close down programs to prevent data loss'. At the same time maxscript crashes and throws the error 'unknown system exception *memory error*'
When I load less files, for example 100 the memory error does not occur, the process finishes and the files are produced. The extremely high memory usage still occurs though (12-13GB for 3ds max whilst running script), after the script has finished the memory usage remains the same. Also I've noticed the harddrive being filled with data whilst the script is running (13GB is added to the appdata folder for every file that is opened/processed, once the scene is reset these 13GB are removed from appdata and after loading the next file the process repeats)(I have no clue how that much data could be added since my .max file is 2 MB (I load the same .max file each iteration) and the text files I am producing with the script are 1.53MB for all of them).
My script does the following:
1) Rotates object to initial rotation (rotation of obj around world Z axis)
2) Rotate object about local Y axis in steps of 1 degree
3) Calculate a variable called rot_ratio (stands for rotation ratio) *The variable rot_ratio helps me determine how well the object 'fits' into the viewport (when viewed from a 'front view' camera)
4) Format calculated rotation ratio value to external file (local rotation angle corresponding to this rot_ratio is also added to external file)
I've tried increasing Heapsize, clearing max's memory in the first few lines of the script, adding garbage collection commands throughout the script (I know very little about garbage collection so the placement of these commands could definitely be better). I've freed up 50 gigs on my SSD to prevent issues with my drive filling up (need disk space for the 13GB being written to appdata). I've also tried increasing my virtual memory to 10 and 20GB (as suggested on another forum).
Info for testing with other .max files: input/output directory are defined in lines 17,18, please change username to your own for testing. Current script is simplified as much as possible for readability and as a result only works with scenes containing a single object which is an editable mesh. I've attached the scene I used for testing in .max format (for 2014, 2015, 2016, 2017 versions of max) and in .obj format.
Any help will be greatly appreciated, thank you! Laughing
-Maarten