Android can't close process

I compiled “hello mobile” from the tutorial using SDL 2.26.3. I did not add any of my own content to the tutorial code. The compiled Android program runs correctly. I added functionality to the program such that the Back button on an Android device sets the quit flag to true within a while loop, allowing the main function to return normally. During debugging, I monitored the Profiler and noted that the activity in Java had been destroyed following the end of the main function, but the memory usage did not return to zero. Since I did not write any of my own code, I suspect that this may be a problem with the SDL2 Android project itself. I speculate that SDL likely has addressed this issue by now.

I am asking if anyone knows of a solution to this issue. It appears that the problem stems from resources not being properly released, which, if left unresolved, can result in a failed reloading of resources when a player switches back to the foreground from the background. This can lead to a black screen. Even if a quit button is not provided, the problem persists because the activity and main function both terminate when the program is switched to the background for an extended period of time.