Notifications
Clear all

[Closed] Batch file used to get around bad memory issue

So for some reason beyond my control, I found myself using Max2010, and having to batch through a mess (50+ .fbx files)

The issue is I put a timer around the Cat Rig Bake function

CaptureAnimation [rig] [mocapNode] …etc etc… and it does fine for the first couple of files, and then it starts spiraling out of control, I thought maybe it’s the file/frame range/length, and so I ran the file that took 2+ Hours to bake by itself and it runs through like the first couple of files i tried 20-30 Min.

So I divided the duration by the number of frames to come up with a seconds / frame calculation to see if certain characters are more cumbersome / error prone than others, nope… they all do fine at roughly .5 sec. a frame to bake over, until you get 4-5 files in and then it starts going up, .8, .9, 1.3, 1.6, 2.2seconds a frame etc… etc… So I went back and added gratuitous
gc()
freescenebitmaps()
clearUndoBuffer()

but still that one process is killing the process, so I’m now trying to run a batch file, to open a new instance of max for every file, but the only thing 3dsmaxcmd is good for is rendering frames… what if you don’t want to render frames, but process data, and save max files ?

I already had to write a workaround to get the fbx file to import into an empty scene, because apparently it’s not smart enough to import a fbx file when you specify it after the 3dsmaxcmd

cd D:\MyTempPath\20120323
D:
for %%x in (*.fbx) do (
echo %%x > C:\Temp\sourceFBXFile.txt
call “C:\Program Files\Autodesk\3ds Max 2010\3dsmax” Empty.max -script:D:\MyTempPath\scripts\BatchConvert.ms
)

This will dump the current file it needs to import into a text file, which the script opens, and then imports into the Empty.max scene file, it then bakes everything over, and saves it to the same path as the source, or looks for a override variable for a destination path…

It actually worked, except it runs the script prior to then trying to render the file… I DON’T want to render anything… is that something that is unfathomable?

Has anybody done something like this in processing / prepping files for animators from mocap ? And what was the methodology ?

Sorry to make this so long winded, but I searched, and wanted to paint a clear picture of what I had tried, and what had / hadn’t worked.

3 Replies

I’m absolutely sure that something wrong with your code (BatchConvert.ms). Probably you use and don’t free some memory. Try to check what is going on with heapfree after every batch iteration.`

Names of characters changed to protect the innocent

FBX file 1 file took 29.8829 minutes
Process for A_ took approx [0.451469] seconds for 1134 frames. Heap Free: 278800L
Process for B_ took approx [0.419353] seconds for 1134 frames. Heap Free: 219200L
Process for C_ took approx [0.367077] seconds for 1134 frames. Heap Free: 226240L
Process for D_ took approx [0.313735] seconds for 1134 frames. Heap Free: 286064L”
FBX file 1 file took 31.5332 minutes
Process for A_ took approx [0.468787] seconds for 1134 frames. Heap Free: 290360L
Process for B_ took approx [0.421326] seconds for 1134 frames. Heap Free: 231824L
Process for C_ took approx [0.404366] seconds for 1134 frames. Heap Free: 239360L
Process for D_ took approx [0.337539] seconds for 1134 frames. Heap Free: 216528L”

FBX file 1 file took 32.3077 minutes
Process for A_ took approx [0.493152] seconds for 1134 frames. Heap Free: 570352L
Process for B_ took approx [0.450257] seconds for 1134 frames. Heap Free: 499072L
Process for C_ took approx [0.407476] seconds for 1134 frames. Heap Free: 492632L
Process for D_ took approx [0.326685] seconds for 1134 frames. Heap Free: 673816L”

FBX file 1 file took 29.8829 minutes
Process for A_ took approx [0.488941] seconds for 1134 frames. Heap Free: 204816L
Process for B_ took approx [0.437939] seconds for 1134 frames. Heap Free: 683376L
Process for C_ took approx [0.401343] seconds for 1134 frames. Heap Free: 368472L
Process for D_ took approx [0.339667] seconds for 1134 frames. Heap Free: 343688L”

FBX file 1 file took 32.2574 minutes
Process for A_ took approx [0.493917] seconds for 1134 frames. Heap Free: 246080L
Process for B_ took approx [0.460825] seconds for 1134 frames. Heap Free: 637096L
Process for C_ took approx [0.436878] seconds for 1134 frames. Heap Free: 632248L
Process for D_ took approx [0.361159] seconds for 1134 frames. Heap Free: 595936L”

FBX file 1 file took 39.3145 minutes Process for A_ took approx [0.580974] seconds for 1134 frames. Heap Free: 244984L
Process for B_ took approx [0.509959] seconds for 1134 frames. Heap Free: 303048L
Process for C_ took approx [0.445846] seconds for 1134 frames. Heap Free: 324752L
Process for D_ took approx [0.371017] seconds for 1134 frames. Heap Free: 280160L”
FBX file took 94.1327 minutes
FBX file took 120.694 minutes
FBX file took 118.79 minutes
FBX file took 143.149 minutes
FBX file took 184.141 minutes

( I don’t have Heap numbers because those times are from before I put them in, and I have to wait for them to get processed)

Each animation (FBX) has the same characters, with one camera, being the difference, once I have the edit locked I can only process the frame range needed but as you can see the duration for each file spirals out of control, and the heap size is all over the place for the files processed.

And the heap numbers print out just after the call that bakes each CAT character, which is why it’s per character and not for each scene, as I can’t see where the memory leak is in my code I suspect cat…

Share with us the exact steps and testing files?