`
Teok
  • 浏览: 150361 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Something about vm gc

 
阅读更多

It works something like this:

 - Bitmap objects live on the virtual heap
 - Bitmap data lives somewhere else (native heap, mmap() region,
imagination land, whatever)
 - Bitmap objects have an integer field which is actually a pointer to
a native struct, which in turn has width, height, stride, format,
pointer to data, etc.
 - When you release() a Bitmap object, it *should* cause all of the
native storage to be released immediately.

If you don't release a Bitmap object, but you do stop using it, it
will be marked for finalization during the next GC.  Some time after
the GC finishes, the finalizer thread runs, and calls release() to
release the native storage.  On the next GC, the Bitmap object is
collected.

So... if the code holding the bitmaps knows that it no longer needs
them, it can free them quickly.  If it doesn't, and just waits until
the Bitmaps stop being referenced by anybody, then you have to wait
for the finalization thread to do its work after the next GC, which
takes a little longer.  The HeapWorker thread handles finalization,
and runs at normal priority, so it should happen fairly soon.

If the external allocation mechanism didn't exist, and you didn't
explicitly manage Bitmaps or manually call System.gc() with some
frequency, the app would just keep piling up bitmaps, gradually
forcing the system to kill other stuff to make room in.  The mechanism
was added to force garbage collection to happen at "appropriate"
times, and to cause things to break if allocations seemed to be
getting out of control.

Unfortunately the "how much is too much" calculation is too obscure,
and the "can I have memory" mechanism is too simplistic (e.g. there is
no association between an allocation for X amount of bytes and the
Bitmap object that will use them), so it's hard to figure out why
things are broken and how one should fix them.
分享到:
评论

相关推荐

    Something about Moblin 2.0

    Something about Moblin 2.0

    tema.rar_Something About You

    【标题】"tema.rar_Something About You" 提到的主题涉及到创建和管理动物园的相关知识,而"Something About You"可能是指个人在这个过程中的角色或特殊经验。从描述中我们可以推测,这个压缩包可能包含了关于如何...

    migong.rar_Something About You

    标题 "migong.rar_Something About You" 暗示我们关注的是一个关于编程学习的压缩包,特别是C和C++语言,以及它们在数据结构方面的应用。描述中提到的 "c and c++ through it you will realize something about data...

    Something About Nginx

    Something About Nginx

    something about UNCTAD

    SOMETHING ABOUT UNCTAD, UNCTAD IS A INTERNATIONAL ORGANISITION ,THIS PPT IS A SAMPLE INTRODUCTION ABOUT IT

    java_FAQ.rar_Something About You

    "java_FAQ.rar_Something About You" 提供的"java FAQ.pdf"很可能包含了一系列关于Java编程的常见问题与解答,帮助开发者解决他们在学习和实践中遇到的问题。下面我们将深入探讨一些Java的核心知识点。 1. **Java...

    一步一步跟我学API.rar_API_Something About You_vss

    在本资源"一步一步跟我学API.rar_API_Something About You_vss"中,我们可以深入学习API(Application Programming Interface)的相关知识,这将涵盖API的基本概念、类型、用途以及如何使用版本控制系统如VSS...

    something about javaScript

    JavaScript,也被称为JS,是一种广泛应用于网页和网络应用的脚本语言,主要在客户端运行,为用户提供动态交互体验。它与Java虽然名字相似,但两者是完全不同的编程语言。JavaScript由网景公司的Brendan Eich在1995年...

    Something about machine learning

    关于机器学习的那些事。论文的报告,主要讲到机器学习中应该注意到的一些民间知识。

    2013年九年级英语下册 Module 1 Travel Something about Travel文章背景材料 外研版

    在2013年九年级英语下册 Module 1 Travel Something about Travel的文章中,作者分享了她对旅行的理解和感悟。文章背景提到,圣诞节临近,作者和朋友们都开始规划旅行,而这一年她的目的地是英国。这不仅是一次简单...

    20bn-something-something-v2-00.zip

    视频处理,行为识别公开数据集,20bn-something-something-v2-00.zip。v2-00~v2-19 基于RGB的Action Recognition相关的实验,频繁的使用到了Something-Something数据集; Something数据集是一个大型的带有标签的记录...

    something about jquery

    **jQuery 知识详解** jQuery 是一款非常流行的 JavaScript 库,它极大地简化了 JavaScript 的使用,使得网页交互、动画效果和事件处理变得更加便捷。对于初学者来说,掌握 jQuery 是一个非常明智的选择,因为它能...

    something-about-ai

    关于AI的东西 该存储库用于记录我感兴趣的任何内容。

    Something

    "Something"这个主题可能涉及到了字体设计的创新、字体在不同场景的应用以及如何通过字体提升设计品质等多个方面。 【描述】:深入探讨字体的美学价值和实用功能,从传统印刷到数字媒体,从基础的宋体、黑体到个性...

    Win32 API 函数大全使用详解 .rar_81I_API_Something About You_Win32 API_Wi

    《Win32 API 函数大全使用详解》是深入理解Windows操作系统编程的重要参考资料,它涵盖了大量用于构建Windows应用程序的函数和接口。Win32 API(Application Programming Interface)是Microsoft为开发者提供的一个...

    Something about 3DTouch标签案例

    作者coderqiao,域名Something-About-3D-Touch,本文主要介绍Home Screen Quick Actions,即通过主屏幕的应用Icon,我们可以用3D Touch呼出一个菜单,进行快速定位应用功能模块相关功能的开发。 详细说明:...

    something等于某物吗?.doc

    例如,"Nobody could deny that Jeff had something about him." 这句话中,"something about him"并不直接等同于"他身上的一些东西",而是暗示杰夫具有某种特质或魅力,可能是他的才华、个性或是影响力,让别人无法...

    something.rar

    标题中的"something.rar"是一个压缩文件,通常用于存储多个相关文件或数据集。根据描述,这个压缩包包含了"something-v1"和"something-v2"两个版本的配置文件,以及训练集、测试集和验证集的CSV文件。CSV(Comma ...

    解决On no!Something has gone wrong.

    Something has gone wrong." 是一个常见的错误提示,通常表示系统遇到了问题或有软件运行异常。解决这个问题需要一系列步骤,包括诊断错误来源、修复相关组件和确保系统的稳定运行。以下是一些相关的Linux知识和...

Global site tag (gtag.js) - Google Analytics