Reloading Scripts with Embedded Images increases memory usage?


#1

Hi everyone< first off sorry if the title is vague/confusing.

I’ve got a script that is currently creating an iconTextButton for every image is finds in a folder, and attaches the image to it.

This naturally initially increases the memory usage of maya, however I have noticed upon reloading the script with source() (in MEL) or reload() (in python), it adds to the memory again, increasing it every time a new script window is open/reloaded.

Ive noticed this happens with normal image()'s too, and even happens on its own without any logic/loops and is simply “hard coded” in.

So my question is - is this normal for Maya? Is there a way to clear the memory when a Maya script window is closed? As a test to prove my theory I embedded a 4k texture on its own to get really noticeable results fast, it increases mayas memory usage by hundreds of MB’s each time the script window is open (the texture itself is like, 1.5MB).

I apologise if this is a silly question, I’ve just never noticed it before due to usually using small icons with very little footprint and whatnot.

Any guidance would be appreciate. Thanks