Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash reloading Big Models #183

Open
MonikaMoon opened this issue May 20, 2021 · 3 comments
Open

Crash reloading Big Models #183

MonikaMoon opened this issue May 20, 2021 · 3 comments

Comments

@MonikaMoon
Copy link

I am creating a 3D model using multiple .stl files. I have updated STLLoaderTask according to my requirement to load multiple .stl files. I also have to add colors, but my model is not rendered correctly with colors. Its getting created for the first time but when I reload the model, my app is crashing with following errors:
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 65431423 byte allocation with 25165824 free bytes and 42MB until OOM, max allowed footprint 517468552, growth limit 536870912
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at java.nio.DirectByteBuffer$MemoryRef.(DirectByteBuffer.java:71)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:257)
at org.andresoviedo.util.io.IOUtils.createNativeByteBuffer(IOUtils.java:64)
at org.andresoviedo.util.io.IOUtils.createFloatBuffer(IOUtils.java:43)
at org.andresoviedo.android_3d_model_engine.services.collada.entities.MeshData.getVertexBuffer(MeshData.java:714)
at com.movechair.modules.main.analysis.ThreeDModel.STLLoaderTask.build(STLLoaderTask.java:213)
at org.andresoviedo.android_3d_model_engine.services.LoaderTask.doInBackground(LoaderTask.java:67)
at org.andresoviedo.android_3d_model_engine.services.LoaderTask.doInBackground(LoaderTask.java:19)
at android.os.AsyncTask$2.call(AsyncTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:246) 
at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:784) 

Please help me with this error.

@jamesbellaero
Copy link

When debugging, always check the top first.

This one seems pretty simple - your phone ran out of memory. Try reducing model complexity.

@MonikaMoon
Copy link
Author

@jamesbellaero What exactly do you mean by reducing model complexity? My requirement is to render 3D model using multiple .stl file, I can not optimize it more. Is there any way to clear cache or Object3D while reloading the model?

@jamesbellaero
Copy link

Perhaps you need to think about the issue differently. I don't know your use case, but generally when people want to render multiple 3D models they're doing video or game production

For videos and scene rendering, people use computers with 64+ GB of RAM and another TB of swap space.

For games, a lot of optimization is performed to reduce model size and render only the necessary components. I would not use this tool for games because I would not use .stl's for games.

@MonikaMoon MonikaMoon changed the title Crash reloading Big Models and model/colors not rendered correctly using .setColorsBuffer(mesh.getColorsBuffer()) Crash reloading Big Models May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants