Results 1 to 14 of 14
- 12-21-2011, 06:33 PM #1
Member
- Join Date
- Dec 2011
- Posts
- 4
- Rep Power
- 0
Over a specific valuet: java.lang.OutOfMemoryError
Hi all,
Here the code
The problem arises when triangleNumber is bigger than about 2 milionsJava Code:vertexData = GLBuffers.newDirectFloatBuffer(triangleNumber*3*3); for(int i=0; i<triangleNumber; i++) { Triangle tmp = triangleArray.get(i); vertexData.put(new float[]{tmp.x1/12000.0f, tmp.y1/12000.0f, tmp.z1/12000.0f, tmp.x2/12000.0f, tmp.y2/12000.0f, tmp.z2/12000.0f, tmp.x3/12000.0f, tmp.y3/12000.0f, tmp.z3/12000.0f });
It seems that the default size is around 64 MB (2M = 68MB)
-XX:MaxDirectMemorySize=256M didnt help >.>
I would need, lets say, to allocate up to 10 milions of triangles (then 10 M *3*3) to push them later in the gpu framebuffer, but 5 can be already a nice solution
Any idea?
- 12-22-2011, 03:09 PM #2
Re: Over a specific valuet: java.lang.OutOfMemoryError
The java.lang.OutOfMemoryError is pretty generic, have you tried just increasing the VM memory allocation?
-Xmx512m -Xms512m
Something like that?
- 12-22-2011, 03:37 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Over a specific valuet: java.lang.OutOfMemoryError
From the docs for -XX:MaxDirectMemorySize:
This option specifies the maximum total size of java.nio (New I/O package) direct buffer allocations.
Not really what you want...
quad64bit has given you the proper switch (-Xmx).
- 12-23-2011, 10:29 AM #4
Member
- Join Date
- Dec 2011
- Posts
- 4
- Rep Power
- 0
Re: Over a specific valuet: java.lang.OutOfMemoryError
I had a java heap overflow and I solved with the first argument that you mention
Right now my arguments are the following, but unfortunately the second one seems to be superfluous
-Xmx1500m -XX:MaxDirectMemorySize=256M
The crash in the console points at the part of code that I illustrated in the first post. And it happens only when triangleNumber is about bigger than 2M so I guess it should be something related to the buffer allocation..no?Last edited by elect; 12-23-2011 at 10:32 AM.
- 12-23-2011, 10:56 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Over a specific valuet: java.lang.OutOfMemoryError
NIO is the New Input/Output package.
It's entirely related to IO...nothing to do with general memory management, or OOM exceptions.
You are not doing any IO there (or using that package) so that parameter is irrelevant.
- 12-23-2011, 11:33 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,420
- Blog Entries
- 7
- Rep Power
- 17
Re: Over a specific valuet: java.lang.OutOfMemoryError
Well, sort of; the NIO package uses the system calls mmap, munmap and compadres (for mapping files to (virtual) memory) and they can take up quite some memory in the process space. I don't know if that memory resides in Java's heap space or not ... (I think it does)
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 12-23-2011, 12:45 PM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Over a specific valuet: java.lang.OutOfMemoryError
But is the OP using any NIO stuff?
There's nothing in that post to suggest it...and if it is the case then maybe it might have been an idea to point it out?
In any case I'd have thought the memory error would have been different than a base heap one if it were to do with NIO.
- 12-23-2011, 12:59 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,420
- Blog Entries
- 7
- Rep Power
- 17
Re: Over a specific valuet: java.lang.OutOfMemoryError
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 12-23-2011, 01:38 PM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Over a specific valuet: java.lang.OutOfMemoryError
Know your place...
- 12-23-2011, 03:05 PM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,420
- Blog Entries
- 7
- Rep Power
- 17
- 12-23-2011, 03:41 PM #11
Re: Over a specific valuet: java.lang.OutOfMemoryError
I've also had strange memory errors in the past with large web apps. In that case, adjusting the perm size helped:
-XX:MaxPermSize=256m -XX:PermSize=128m
FYI the second argument isn't required, but I like to set minimums for certain contexts!
- 12-23-2011, 04:49 PM #12
Member
- Join Date
- Dec 2011
- Posts
- 4
- Rep Power
- 0
Re: Over a specific valuet: java.lang.OutOfMemoryError
- 12-28-2011, 01:09 PM #13
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Over a specific valuet: java.lang.OutOfMemoryError
- 01-12-2012, 05:14 PM #14
Member
- Join Date
- Dec 2011
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
java.lang.OutOfMemoryError..Help me
By kathir0301 in forum Advanced JavaReplies: 1Last Post: 11-22-2010, 08:44 AM -
Ant fileset java.lang.OutOfMemoryError
By 1inmillion in forum Advanced JavaReplies: 0Last Post: 12-23-2008, 04:27 PM -
java.lang.OutOfMemoryError
By new_2_java in forum New To JavaReplies: 2Last Post: 11-01-2008, 05:12 AM -
java.lang.OutOfMemoryError
By vidhya.sk in forum New To JavaReplies: 2Last Post: 09-18-2008, 12:21 PM -
java.lang.OutOfMemoryError in a web service client
By elchape in forum Advanced JavaReplies: 4Last Post: 06-28-2008, 05:21 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks