From 362f002d362ab60fbcb8aa1d91b8761c055ec792 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 13 Nov 2017 01:30:08 +0900 Subject: [PATCH] ui: Delete local variables asap on Android --- internal/ui/ui_android.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/ui/ui_android.go b/internal/ui/ui_android.go index b134044ed..dac89d66f 100644 --- a/internal/ui/ui_android.go +++ b/internal/ui/ui_android.go @@ -44,6 +44,13 @@ static float deviceScale(uintptr_t java_vm, uintptr_t jni_env, uintptr_t ctx) { (*env)->GetFloatField( env, displayMetrics, (*env)->GetFieldID(env, android_util_DisplayMetrics, "density", "F")); + + (*env)->DeleteLocalRef(env, android_content_ContextWrapper); + (*env)->DeleteLocalRef(env, android_content_res_Resources); + (*env)->DeleteLocalRef(env, android_util_DisplayMetrics); + (*env)->DeleteLocalRef(env, resources); + (*env)->DeleteLocalRef(env, displayMetrics); + return density; }