のねのBlog

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

Cache

   4186     final void handleLowMemory() {
   4187         ArrayList<ComponentCallbacks2> callbacks = collectComponentCallbacks(true, null);
   4188 
   4189         final int N = callbacks.size();
   4190         for (int i=0; i<N; i++) {
   4191             callbacks.get(i).onLowMemory();
   4192         }
   4193 
   4194         // Ask SQLite to free up as much memory as it can, mostly from its page caches.
   4195         if (Process.myUid() != Process.SYSTEM_UID) {
   4196             int sqliteReleased = SQLiteDatabase.releaseMemory();
   4197             EventLog.writeEvent(SQLITE_MEM_RELEASED_EVENT_LOG_TAG, sqliteReleased);
   4198         }
   4199 
   4200         // Ask graphics to free up as much as possible (font/image caches)
   4201         Canvas.freeCaches();
   4202 
   4203         // Ask text layout engine to free also as much as possible
   4204         Canvas.freeTextLayoutCaches();
   4205 
   4206         BinderInternal.forceGc("mem");
   4207     }
    673 static void freeCaches(JNIEnv* env, jobject) {
    674     SkGraphics::PurgeFontCache();
    675 }
    677 static void freeTextLayoutCaches(JNIEnv* env, jobject) {
    678     Layout::purgeCaches();
    679 }
    683 static JNINativeMethod gMethods[] = {
    734     {"freeCaches", "()V", (void*) CanvasJNI::freeCaches},
    735     {"freeTextLayoutCaches", "()V", (void*) CanvasJNI::freeTextLayoutCaches}
    736 };