1
\$\begingroup\$

So, I have a lot of texture atlases in my code for a talking tom type libgdx, and I use around 6 of them per screen. The app crashes abruptly without any errors on devices with 1gb ram or less. I started profiling my code and found that I have 3500+ texture bindings, how should i minimize these?

\$\endgroup\$
1
\$\begingroup\$

Are you using the AssetManager? You can load/unload only when a texture is needed and in the end discard all at once. Furthermore, there should never exist more than 1 instance for every unique texture (atlas). Share a pointer with all your entities.

https://libgdx.badlogicgames.com/nightlies/docs/api/

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Maybe you have local variable and you create those objects with those variables. Textures in libgdx doesn't have garbage collector. You must free the memory yourself with the method dispose().

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.