Out Of Memory error?

Started by Disastorm, July 21, 2011, 03:45:33 AM

Previous topic - Next topic

EgonOlsen

I thought it might be helpful to somebody, so i wrote a little page for the wiki that briefly explains some techniques to save memory: http://www.jpct.net/wiki/index.php/Reducing_memory_usage.

Disastorm

#16
Thanks for that link.  It has a few things I wasn't doing like compressing meshes and whatnot so that should help.  I have another question.   If I have a bunch of the same object is it better (in terms of memory) to have them as separate cloned objects sharing compiled data, or perhaps to merge them all into a single Object3D?

Also I noticed it says to compress keyframe animation meshes, but should I also compress the main object's mesh?

EgonOlsen

Merging stuff is always faster and uses less memory. So if possible, merge them. You can compress the object's mesh too, but depending on the way it was created, it might be compressed already. The gain from compressing meshes usually isn't that high.

Disastorm

#18
hey question what would happen if you merge a non-animated object with an animated one.  will it become animated and keep the animation of the object?

Also you say merging is always less memory, by why does the javadoc say:

"Merging objects is quite expensive in terms of memory usage."

And also it looks like when I merged it actually did ended up taking more memory:
4993 to 5018 after initialization

EgonOlsen

Merging is memory intense, not the merged result. Simply because in the process, you need twice the memory that the objects to be merged require. After that, memory usage is a bit lower. Your numbers are so close together that i wouldn't even worry about it. In general, merging reduces instance count in main memory and on the GPU. It also allows the engine to process the geometry faster. If you are able to merge, then merge.

Disastorm

#20
Ok thanks.  Also another question about merging, does it matter if you merge clone objects as opposed to real objects? The final result should be the same either way right?  Also what about animated objects? I should keep that separate from non animated objects?

EgonOlsen

Merging cloned objects...doesn't make much sense, does it? Why not merge the blueprint object multiple times instead of creating a clone and merging that. Merging animated objects doesn't work...or at least you'll lose the animation, so i guess it's save to say that it "doesn't work". It might not be a smart either, because it would increase the time needed for vertex updates. I suggest to merge static geometry at startup if possible but don't bother with merging animated objects somehow.