1
votes

I'm using Android Min3d library to load and draw a 3D Model from Wavefront .obj file.

The library works fine (loading and drawing from .obj file) but the problem is when I close the app, then I launch it again for the second time, the app crashes and shows java.lang.OutOfMemoryError when it's trying to create Bitmap for mesh textures. I use a single large texture for a 3D model (2048 x 2048 in size).

Does the fact that it crashes on the second launch indicate that there's memory leak in Min3d framework?

Has anybody using this library ever meet this problem? And how do you solve this?

I've tried to read the source code, and i see that the bitmaps for the texture are always recycled after Min3D sends the texture to the GPU. So I didn't find any leak yet.

Can you give me insights about what could be the problem in this case? Thx in advance.

Note: If I resize the texture to 1024x1024, the second launch doesn't crash, but the app will crash in 4th/5th launch instead.

2
I've been tracing for the memory leaks, and so far I'm pretty sure that the bitmaps aren't the source of the leaks. Buffers that hold obj data (such as vertex position, normals, uv coord, etc) might be the source of the leakshenrywibowo

2 Answers

1
votes

clear your gamemodel on start. lists, arrays ... if you use async tasks, take a look at them.

0
votes

Try to use a smaller texture (less than 1024x1024)