android: kindly ask the GC to do its thing when the OS is low on memory
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 1 Nov 2017 15:14:12 +0000 (11:14 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 28 Nov 2017 14:31:29 +0000 (09:31 -0500)
bdwgc will try to release some of its memory if compiled with -DUSE_MUNMAP.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/android/native_app_glue.nit
lib/android/nit_activity.nit

index 2a8f895..1769e0c 100644 (file)
@@ -195,7 +195,7 @@ redef class App
        # Notification from the Android framework, the system is running low on memory
        #
        # Try to reduce your memory use.
-       fun low_memory do end
+       fun low_memory do force_garbage_collection
 
        # Notification from the Android framework, the current device configuration has changed
        fun config_changed do end
index dac5a78..f084958 100644 (file)
@@ -287,7 +287,7 @@ class Activity
        # Notification from Android, the system is running low on memory
        #
        # Try to reduce your memory use.
-       fun on_low_memory do end
+       fun on_low_memory do force_garbage_collection
 
        # Notification from Android, the current window of the activity has lost or gained focus
        fun on_window_focus_changed(has_focus: Bool) do end