Running this code the Note 5 was able to get to 108 textures but the Poco could only create 68 textures.
The samsung reports lower system and gpu memory than the poco.
Reading proc/memory doesn’t give me any decent results on samsung for available memory and free on both devices is very similar so I can use that to lower texture settings for these edge cases.
public class GenerateTextures : MonoBehaviour
{
List<RenderTexture> textures = new List<RenderTexture>();
// Start is called before the first frame update
IEnumerator Start()
{
int i = 0;
while(Application.isPlaying)
{
var a = new RenderTexture(2048, 2048, 8);
Graphics.Blit(null, a);
textures.Add(a);
Graphics.DrawTexture(new Rect(0,0,100,100), a);
yield return new WaitForSeconds(1);
i++;
}
}
}
Using MemoryInfo I get these results (poco phone top, note 5 bottom). The Note 5 is working well, it crashes out when the memory gets low but the poco seems to want to hover at 960mb (there was 1 time when I could get lower but I have no idea why it did that).
Poco started with 1646 available
Note 5 started with 1707 available
At this point, it doesn’t really matter all that much how much ram a phone has, it’s there for multitasking, not so one app can take it all (or even a big chunk of it). The OS has a hard limit of RAM for each APP.
Maybe these phones have different OSes with different limits and memory management?
It could be. But ideally the OS should let us know how much we can use via the threshold. But after a bit more testing I’m fairly confident the issue is that the GPU limits differ from overall ram and some are allowed to go much further than others.
Pretty sure there are APIs in both iOS and Android to help with that.
Plus both OSes send warnings when you pass the memory limit. If you don’t reduce memory usage soon after receiving the warnings, your app gets terminated.
AFAIK Unity doesn’t do anything in response to those warnings, nor is there a super easy way to access them from Unity.
This works great on my Note 5 but it never fires on my POCOPHONE F1 and that is also correct because the OS is reporting that there is plenty of memory available right before it crashes. Definitely a per device or gpu problem, not unity.
Has anyone found a solution to this problem? Our app runs perfectly fine on iOS, but won’t load more than a few meshes with textures. Textures and meshes are all reduced as much as possible on import. Doesn’t matter if we load the assets in via Instantiate or if they exist in scene when it loads.