Huge memory leak when drawing shapes on surface textures on Mali G68/G72/G77 Android 12+

Hello dear community!

I have faced enormous memory allocation (1GB per second) and application crash when drawing surface paths on terrain textures in my 3D GIS engine on Mali GPUs since Android 12.

Here you can find a code in methods drawShapesToTexture and drawTextureToTerrain

This issue is available only on Mali GPU and only starting from Android 12+

Affected and tested devices are:

Galaxy Tab Active3 Mali G72 Android 13

Galaxy A53 Mali G68 Android 13

Galaxy S20 Mali G77 Android 12

Devices which works ok:

Galaxy Note 9 Mali G72 Android 10 (the same GPU as in the affected list above)

Any Adreno, PowerVR or other GPU equipped device.

It seems that new driver allocates copy of texture memory each time I bind frame buffer and use color attachment to draw lines in terrain texture. Drawing terrain textures without shapes works ok.

To reproduce an issue you can build a project using link above and run worldwind-examples application MGRSGraticuleActivity and just zoom map.

It is required only 2 seconds to overflow 2 GB of VRAM and crash the application.

Could you please assist is it a driver bug or what was conceptually changed?

Why the same code works on all other GPUs and worked already 4 years before on many devices, but now started providing OOM errors on modern Mali equipped devices?