File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Java3D - heap space problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java3D - heap space problem" Watch "Java3D - heap space problem" New topic
Author

Java3D - heap space problem

David Starina
Greenhorn

Joined: May 28, 2012
Posts: 3

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

Joined: May 28, 2012
Posts: 3

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

Joined: Jul 19, 2011
Posts: 175

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.


Please correct my English.
David Starina
Greenhorn

Joined: May 28, 2012
Posts: 3

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

Joined: Jul 19, 2011
Posts: 175

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java3D - heap space problem