Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Open the file more than one hundred times, resulting in a crash

Open the file more than one hundred times, resulting in a crash

mx_zwh
Contributor Contributor
1,799 Views
21 Replies
Message 1 of 22

Open the file more than one hundred times, resulting in a crash

mx_zwh
Contributor
Contributor

-------------------maxscript -----------------------------

for i = 1 to 200 do(
loadmaxfile XXX Quiet:true
filein YYY
resetMaxFile #noprompt

)
------------------------------------------------

It will crash at the 100th time

0 Likes
1,800 Views
21 Replies
Replies (21)
Message 2 of 22

denisT.MaxDoctor
Advisor
Advisor

I see only one reason - some memory issue...

 

add this code to check the memory information to see how things go:

 

(
	r = sysinfo.getSystemMemoryInfo()
	
	for i = 2 to 7 do r[i] = (r[i] / 1024) / 1024.0 
	
	format "MEMORY IN USE\t (\%)\n"
	format "\t\tused:\t%\n" 		(int r[1])
	format "PHYSICAL MEMORY\t (MB)\n"
	format "\t\ttotal:\t%\n" 		r[2]
	format "\t\tfree:\t%\n" 		r[3]
	format "\t\tused:\t%\n" 		(r[2]-r[3])
	format "PAGING FILE SIZE (MB)\n"
	format "\t\ttotal:\t%\n"		r[4]
	format "\t\tfree:\t%\n" 		r[5]
	format "\t\tused:\t%\n" 		(r[4]-r[5])
	format "VIRTUAL MEMORY\t (MB)\n"
	format "\t\ttotal:\t%\n" 		r[6]
	format "\t\tfree:\t%\n" 		r[7]
	format "\t\tused:\t%\n" 		(r[6]-r[7])
	
	ok
)

 

 

if there is a memory leak, it is in "filein"

0 Likes
Message 3 of 22

istan
Advisor
Advisor

you could also try a gc() in the loop - sometimes it helps.

0 Likes
Message 4 of 22

denisT.MaxDoctor
Advisor
Advisor

@istan wrote:

you could also try a gc() in the loop - sometimes it helps.


it makes a RESET max file according to the sample code above ... which is automatic garbage collection.

0 Likes
Message 5 of 22

mx_zwh
Contributor
Contributor
I tried using gc(), but the situation didn't get better. It was very painful
0 Likes
Message 6 of 22

trykle
Contributor
Contributor

Years of batch processing experience tells me, There is only one way:

open 3dsmax.exe, open max file, filein script, kill 3dsmax.exe

open 3dsmax.exe, open max file, filein script, kill 3dsmax.exe

open 3dsmax.exe, open max file, filein script, kill 3dsmax.exe

......

0 Likes
Message 7 of 22

denisT.MaxDoctor
Advisor
Advisor

you have to understand that what you're doing in filein is causing the crash... it's hard to tell what it is specifically without seeing the code. So the only solution seems possible is to fix the code you are using in filein.

0 Likes
Message 8 of 22

mx_zwh
Contributor
Contributor

This is too slow, but there seems to be no good way

0 Likes
Message 9 of 22

mx_zwh
Contributor
Contributor

filein file sample like
---------------------------------
xxx.name = “xxxx” 
max file save

---------------------------------

0 Likes
Message 10 of 22

denisT.MaxDoctor
Advisor
Advisor

have you tried just only opening files? ... in sequence

 

 

fn batchLoadMaxFiles dir: = 
(
	if dir == unsupplied do dir = getSavePath()
	if doesfileexist dir do 
	(
		files = getFiles (pathConfig.appendPath dir "*.max")
		if (count = files.count) do with quiet on
		(
			cancel = off
			for k=1 to count while not cancel do
			(
				if keyboard.escPressed then
				(
					cancel = on
					format "\nBatch was canceled!\n"	
				)
				else
				(
					file = files[k]
					format "%(%) ...\n" (formattedprint k format:"03d") (formattedprint count format:"03d")
					loadMaxFile file quiet:on allowPrompts:off
					format "\t>> %\n" file
					resetMaxFile #noPrompt
				)
			)
		)
		count
	)
)
/* RUN IT!
batchLoadMaxFiles()
*/

 

 

0 Likes
Message 11 of 22

mx_zwh
Contributor
Contributor

I tried, but it still crashed

0 Likes
Message 12 of 22

mx_zwh
Contributor
Contributor

3dsmax2022

0 Likes
Message 13 of 22

denisT.MaxDoctor
Advisor
Advisor

what are these files? What is the main content : animation, geometry, materials?   

0 Likes
Message 14 of 22

mx_zwh
Contributor
Contributor

animation file

0 Likes
Message 15 of 22

Serejah
Advocate
Advocate

did you try to load files in reverse order to ensure that it is indeed a script issue and not the corrupt scene file that leads to crash?

0 Likes
Message 16 of 22

denisT.MaxDoctor
Advisor
Advisor

@mx_zwh wrote:

animation file


Biped? Layers, Mixer?

 

How much memory do you initially allocate? 

denisTMaxDoctor_0-1677221777303.png

 

0 Likes
Message 17 of 22

mx_zwh
Contributor
Contributor

default:100

0 Likes
Message 18 of 22

denisT.MaxDoctor
Advisor
Advisor

Find one file that crashes the system due to 50–100 loads, and post it here. I will try to find a time to look at it.
I don't see any other way to figure out what's going on.

0 Likes
Message 19 of 22

mx_zwh
Contributor
Contributor

It's not a file problem. It's a problem with 3dsmax software. I changed different files. It's all like this,lol

0 Likes
Message 20 of 22

denisT.MaxDoctor
Advisor
Advisor

What if I tell you that some of my batches are 400–800 files each and they work stably?

 

However, it is up to you... You can blame the software if it helps you in any way.

0 Likes