Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java3D - heap space problem

 
David Starina
Greenhorn
Posts: 8
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to draw an object in Java3D - I have a space of 500*500*250 pixels.
I am only interested in the visible voxels, so I have about 300 000 voxels. When trying to draw them, I get a heap space error (or sometimes OutOfMemoryError). Is this too many objects for Java3D to hold - I don't think that should be the case, I am probably doing something wrong in the code.

This is my code for drawing voxels:



Thanks!
 
David Starina
Greenhorn
Posts: 8
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

if you have a look at my code - is this even the correct way to draw a large number of objects in Java3D?

Thank you,
David
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not familiar with java3d but you might try to reduce the number of new instances of Objects and see if you can reuse some of them.
 
David Starina
Greenhorn
Posts: 8
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manuel,

thank you - this is what I am trying to achieve ... I have tried using only one Appearance and ColoringAttributes (each voxel will need its own color, though), but I can not achieve the same with other objects - each Box needs to have its own transformation (each is on its own location). Still got the same error ...
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I really got no idea about java3d, (I used jogl though) my last idea would be trying to increase the memory available to your jvm.
You should check at what iteration of your code the error arises though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic