• <small id='ZeHjo'></small><noframes id='ZeHjo'>

  • <tfoot id='ZeHjo'></tfoot>

  • <legend id='ZeHjo'><style id='ZeHjo'><dir id='ZeHjo'><q id='ZeHjo'></q></dir></style></legend>
      <i id='ZeHjo'><tr id='ZeHjo'><dt id='ZeHjo'><q id='ZeHjo'><span id='ZeHjo'><b id='ZeHjo'><form id='ZeHjo'><ins id='ZeHjo'></ins><ul id='ZeHjo'></ul><sub id='ZeHjo'></sub></form><legend id='ZeHjo'></legend><bdo id='ZeHjo'><pre id='ZeHjo'><center id='ZeHjo'></center></pre></bdo></b><th id='ZeHjo'></th></span></q></dt></tr></i><div id='ZeHjo'><tfoot id='ZeHjo'></tfoot><dl id='ZeHjo'><fieldset id='ZeHjo'></fieldset></dl></div>
        <bdo id='ZeHjo'></bdo><ul id='ZeHjo'></ul>

      1. Android 中的垃圾收集器

        时间:2023-07-13
        1. <tfoot id='dgrNw'></tfoot>
            <bdo id='dgrNw'></bdo><ul id='dgrNw'></ul>

            • <legend id='dgrNw'><style id='dgrNw'><dir id='dgrNw'><q id='dgrNw'></q></dir></style></legend>
                <tbody id='dgrNw'></tbody>

                <small id='dgrNw'></small><noframes id='dgrNw'>

                  <i id='dgrNw'><tr id='dgrNw'><dt id='dgrNw'><q id='dgrNw'><span id='dgrNw'><b id='dgrNw'><form id='dgrNw'><ins id='dgrNw'></ins><ul id='dgrNw'></ul><sub id='dgrNw'></sub></form><legend id='dgrNw'></legend><bdo id='dgrNw'><pre id='dgrNw'><center id='dgrNw'></center></pre></bdo></b><th id='dgrNw'></th></span></q></dt></tr></i><div id='dgrNw'><tfoot id='dgrNw'></tfoot><dl id='dgrNw'><fieldset id='dgrNw'></fieldset></dl></div>

                • 本文介绍了Android 中的垃圾收集器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我看到很多 Android 回答建议在某些情况下调用垃圾收集器.

                  I have seen many Android answers that suggest calling the garbage collector in some situations.

                  在执行需要大量内存的操作之前请求 Android 中的垃圾收集器是一种好习惯吗?如果没有,我是否应该只在收到 OutOfMemory 错误时才调用它?

                  Is it a good practice to request the garbage collector in Android before doing a memory-hungry operation? If not, should I only call it if I get an OutOfMemory error?

                  在求助于垃圾收集器之前我还应该使用其他东西吗?

                  Are there other things I should use before resorting to the garbage collector?

                  推荐答案

                  对于 3.0 honeycomb 之前的版本:是的,调用 System.gc().

                  我尝试创建位图,但总是收到VM 内存不足错误".但是,当我先调用 System.gc() 时,就可以了.

                  I tried to create Bitmaps, but was always getting "VM out of memory error". But, when I called System.gc() first, it was OK.

                  在创建位图时,Android 经常会因内存不足错误而失败,并且不会首先尝试进行垃圾收集.因此,调用 System.gc(),您就有足够的内存来创建位图.

                  When creating bitmaps, Android often fails with out of memory errors, and does not try to garbage collect first. Hence, call System.gc(), and you have enough memory to create Bitmaps.

                  如果创建对象,我认为 System.gc 会在需要时自动调用,但 不是 用于创建位图.它只是失败了.

                  If creating Objects, I think System.gc will be called automatically if needed, but not for creating bitmaps. It just fails.

                  所以我建议在创建位图之前手动调用 System.gc().

                  So I recommend manually calling System.gc() before creating bitmaps.

                  这篇关于Android 中的垃圾收集器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:超出 GC 开销限制 下一篇:如何监控 Java 内存使用情况?

                  相关文章

                • <legend id='zOGIQ'><style id='zOGIQ'><dir id='zOGIQ'><q id='zOGIQ'></q></dir></style></legend>

                      <bdo id='zOGIQ'></bdo><ul id='zOGIQ'></ul>
                    <i id='zOGIQ'><tr id='zOGIQ'><dt id='zOGIQ'><q id='zOGIQ'><span id='zOGIQ'><b id='zOGIQ'><form id='zOGIQ'><ins id='zOGIQ'></ins><ul id='zOGIQ'></ul><sub id='zOGIQ'></sub></form><legend id='zOGIQ'></legend><bdo id='zOGIQ'><pre id='zOGIQ'><center id='zOGIQ'></center></pre></bdo></b><th id='zOGIQ'></th></span></q></dt></tr></i><div id='zOGIQ'><tfoot id='zOGIQ'></tfoot><dl id='zOGIQ'><fieldset id='zOGIQ'></fieldset></dl></div>

                  1. <tfoot id='zOGIQ'></tfoot>
                  2. <small id='zOGIQ'></small><noframes id='zOGIQ'>