texture memory available

Hello.

Into the solar2D documentation, it is wrote that we should reduce the texture memory !
ok !

I can get the amount of texture memory used with

system.getInfo( "textureMemoryUsed" )

But how do I know how much memory I can use?
It probably depends on the device, but can we have this information somewhere?

I have asked this question before, yes, you are right.

We can only understand the memory of the device by ourselves~~

Apple has fixed specifications, but Android does not. You must estimate it yourself. :eyes:

Ok Thank’s.
And what happened if we use more memory than available ?

One of the problems I have encountered is that it will turn into a black block, in the case of an animated character, it will turn into a completely black rectangular bar moving.

There isn’t a Solar2D API for getting the device’s total or current memory usage, but you can do so via iOS/Android native calls.

The documentation’s points about reducing (texture) memory usage were written several years ago, and while that is still a good practice, it isn’t as important as before. Some 5-7 years ago, for instance, lower end devices might have had so little RAM that unoptimised games wouldn’t have been able to run. Now, with devices packing more RAM in general, you can get by with less optimised games (see the entire AAA games industry for example).

If your app exceeds the maximum available RAM for the device, then the OS may start to try releasing some memory by closing other background apps (which the users won’t like). If the device runs out of RAM, then the app will likely terminate.

As for what @vb66r55 said, if the individual textures are too large, then they won’t get rendered.

1 Like

This of course is entirely use case dependent!!

What will happen is your app will get sent a low memory message (this can be caught by the Solar API). If your app does not reduce memory usage then it simply be terminated without warning.

Of course users will immediately complain that your app crashed (because they know no different) and you’ll get a heap of 1 star reviews.

I have battled this for years and basically you can use around 50-60% of available RAM before the OS will complain. Note this is not device RAM as other processes will also be using this (particularly social media apps, etc).

1 Like

Ok.
Thank you for all this informtation !
The best we can do is to optimize memory usage !