ARTICLE AD BOX
I am looking for a way to display a "Critical Memory" warning to the user when application reaches "Out of Memory' (OOM) state.
When app reaches the OOM state, the Java heap is exhausted. I have found that standard UI artefacts like AlertDialog, PopupWindow, are unreliable in this scenario because:
Inflation: They require the LayoutInflater to create new objects.
Window Management: Calling .show() triggers internal allocations for window tokens and decoration views.
If the heap is full, these calls trigger a "double crash," killing the process before the UI can even be rendered to the screen.
I need an UI artefact or a strategy that allows me to "pre-allocate" or "reserve" a UI element at app startup (when memory is healthy) that can be triggered/revealed later without requesting significant new memory from the OS at the moment of the crash.
