jPCT - a 3d engine for Java > Bugs

OutOfMemoryError

(1/2) > >>

mystara:
Hello,

I've been experiencing OutOfMemory (heap) errors in my application when I repeatedly create a new world object and populate it (with the same objects each time). To my knowledge, this can only really be caused by some kind of memory leak. As the memory used before and after the world is recreated should be identical.

In trying to track down this problem, the only clue I've discovered is that preventing rendering of my world object seems to remove the OutOfMemory error. The function which, when removed from my main loop, eliminates the OutOfMemoryError is as follows:


--- Code: ---public void renderWorld()
{
if (switchMode != 0)
switchOptions();

World theWorld = gstate.getWorld();

buffer.clear();
theWorld.renderScene(buffer);

if (!wireframe)
theWorld.draw(buffer);
else
theWorld.drawWireframe(buffer, Color.white);

buffer.update();
display();
}

--- End code ---

Any clues as to why this might be causing problems if the world and camera are changed by another object? Anything obviously amiss?
Or any ideas as to how to find this stupid error?

Other hints welcome :P

EgonOlsen:
That should not happen...can you create a simple test case that shows this problem?

mystara:
It's entirely reproducable in my own code. Though it's very large, and it's entirely possible that something else is going wrong though. That's why I was wondering if there was an easy way to locate the source of the leak.

But I'll see if I can combine the bits together

mystara:
Ah,

It was easier than I thought to reproduce.
I have emailed the Java source to you.

NB: I can't seem to determine what version of JPCT I'm using. It's either 1.5 or 1.4, but I suspect it's 1.5

Cheers!

EgonOlsen:

--- Quote from: mystara on May 03, 2008, 07:02:26 pm ---I have emailed the Java source to you.

--- End quote ---
I haven't received anything yet.. ???

Navigation

[0] Message Index

[#] Next page

Go to full version