のねのBlog

パソコンやソフト開発で起きた問題など書きます。よろしくお願いします。

freeTextLayoutCaches

Cross Reference: /frameworks/base/core/jni/android_graphics_Canvas.cpp

    630     {"freeTextLayoutCaches", "()V", (void*) CanvasJNI::freeTextLayoutCaches}

Cross Reference: /frameworks/base/core/jni/android_graphics_Canvas.cpp

    569 static void freeTextLayoutCaches(JNIEnv* env, jobject) {
    570     Layout::purgeCaches();
    571 }

使っているところ
Cross Reference: /frameworks/base/core/java/android/app/ActivityThread.java

   4935     final void handleLowMemory() {
   4936         ArrayList<ComponentCallbacks2> callbacks = collectComponentCallbacks(true, null);
   4937 
   4938         final int N = callbacks.size();
   4939         for (int i=0; i<N; i++) {
   4940             callbacks.get(i).onLowMemory();
   4941         }
   4942 
   4943         // Ask SQLite to free up as much memory as it can, mostly from its page caches.
   4944         if (Process.myUid() != Process.SYSTEM_UID) {
   4945             int sqliteReleased = SQLiteDatabase.releaseMemory();
   4946             EventLog.writeEvent(SQLITE_MEM_RELEASED_EVENT_LOG_TAG, sqliteReleased);
   4947         }
   4948 
   4949         // Ask graphics to free up as much as possible (font/image caches)
   4950         Canvas.freeCaches();
   4951 
   4952         // Ask text layout engine to free also as much as possible
   4953         Canvas.freeTextLayoutCaches();
   4954 
   4955         BinderInternal.forceGc("mem");
   4956     }
   4762     static void freeTextLayoutCachesIfNeeded(int configDiff) {
   4763         if (configDiff != 0) {
   4764             // Ask text layout engine to free its caches if there is a locale change
   4765             boolean hasLocaleConfigChange = ((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
   4766             if (hasLocaleConfigChange) {
   4767                 Canvas.freeTextLayoutCaches();
   4768                 if (DEBUG_CONFIGURATION) Slog.v(TAG, "Cleared TextLayout Caches");
   4769             }
   4770         }
   4771     }

Cross Reference: /frameworks/base/graphics/java/android/graphics/Canvas.java

   1980 
   1981     /**
   1982      * Free up as much memory as possible from private caches (e.g. fonts, images)
   1985      */
   1986     public static native void freeCaches();
   1987 
   1988     /**
   1989      * Free up text layout caches
   1992      */
   1993     public static native void freeTextLayoutCaches();
   1994