Author Topic: Out Of Memory error?  (Read 7326 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Out Of Memory error?
« Reply #15 on: July 22, 2011, 11:54:53 am »
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.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: Out Of Memory error?
« Reply #16 on: July 22, 2011, 09:47:48 pm »
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?
« Last Edit: July 22, 2011, 09:50:52 pm by Disastorm »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Out Of Memory error?
« Reply #17 on: July 23, 2011, 08:58:04 am »
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.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: Out Of Memory error?
« Reply #18 on: July 24, 2011, 01:22:12 am »
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
« Last Edit: July 24, 2011, 03:29:25 am by Disastorm »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Out Of Memory error?
« Reply #19 on: July 24, 2011, 05:13:14 pm »
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.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: Out Of Memory error?
« Reply #20 on: July 25, 2011, 11:25:40 am »
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?
« Last Edit: July 25, 2011, 11:41:15 am by Disastorm »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Out Of Memory error?
« Reply #21 on: July 25, 2011, 09:43:51 pm »
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.