Page 1 of 1

Not enough memory to save project

Posted: Oct 28th, '17, 11:58
by SimpleSi
Working on my readGIF project (with a large 20MB animated gif loaded in) I was unable to save the project - said not enough memory

So I copied all scripts to clipboard and pasted them into a text file and then exported the class

Clicked on new and imported the saved class and all OK :)

But I'm thinking maybe having something to reduce memory before saving might be useful for non-expert users

Maybe a tick box in the save dialog to save without contents of variables?

Or a tick box on variables tab to clear all variable contents? (This could be useful anyway during project developments)

Re: Not enough memory to save project

Posted: Oct 28th, '17, 12:48
by JohnM
I think you may be right that GP is running out of memory.

Having a lot of blocks visible (or potentially visible, even if they are scrolled offscreen) uses up a lot of memory. I've known about that problem for some time, but it's going to require a pretty major re-engineering of the blocks rendering system to fix it. Your GIF Reader is, unfortunately, pushing the limits of the system.

A possible workaround for saving might be to make a dummy class with no scripts and select that class before saving. That will free up the memory used by the blocks in the GIFReader class, giving GP more memory to use for the saving process.

Another thing that might help a bit is to break the big script into smaller methods or functions.

I can also push up GP's memory limit, which is currently 200MB of object memory. That's pretty small by today's App standards, but when GP is running the browser on mobile devices it can only reliably get about 100MB and I didn't want the stand-alone version to behave too differently from the browser version. The best long-term solution is to re-engineer the rendering system, but that could have negative performance impacts if not done cleverly. That's on my to-do list but I'm not sure exactly when I'll tackle it.

Re: Not enough memory to save project

Posted: Oct 28th, '17, 14:16
by SimpleSi
A possible workaround for saving might be to make a dummy class with no scripts and select that class before saving. That will free up the memory used by the blocks in the GIFReader class, giving GP more memory to use for the saving process.
I'll try that out if it happens again