android-3D-model-viewer
android-3D-model-viewer copied to clipboard
Crash reloading Big Models
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.
Please help me with this error.
When debugging, always check the top first.
This one seems pretty simple - your phone ran out of memory. Try reducing model complexity.
@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?
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.