Clear image caches in reaction to system VM warnings

* java/org/gnu/emacs/EmacsNative.java (onLowMemory):

* java/org/gnu/emacs/EmacsService.java (onLowMemory): New
function.

* src/android.c (android_on_low_memory, onLowMemory): New
functions called when a VM caution is registered.  Clear
the image cache and run garbage collection.
This commit is contained in:
Po Lu
2023-11-10 14:57:24 +08:00
parent 5dc3c9f4ec
commit 5324723c2b
3 changed files with 35 additions and 0 deletions

View File

@@ -321,6 +321,10 @@ public final class EmacsService extends Service
}
}
/* The native functions the subsequent two functions call do nothing
in the infrequent case the Emacs thread is awaiting a response
for the main thread. Caveat emptor! */
@Override
public void
onDestroy ()
@@ -333,6 +337,14 @@ public final class EmacsService extends Service
super.onDestroy ();
}
@Override
public void
onLowMemory ()
{
EmacsNative.onLowMemory ();
super.onLowMemory ();
}
/* Functions from here on must only be called from the Emacs