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

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

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

    1. <legend id='jSROk'><style id='jSROk'><dir id='jSROk'><q id='jSROk'></q></dir></style></legend>

        Android 中的垃圾收集器正在运行,但 ddms 的分配跟踪器中没有显示任何已分配的内容

        Garbage collector in Android is running, but nothing is shown as being allocated in ddms#39; allocation tracker(Android 中的垃圾收集器正在运行,但 ddms 的分配跟踪器中没有显示任何已分配的内容)
          • <small id='kJFQh'></small><noframes id='kJFQh'>

              <tbody id='kJFQh'></tbody>
              <bdo id='kJFQh'></bdo><ul id='kJFQh'></ul>

                <legend id='kJFQh'><style id='kJFQh'><dir id='kJFQh'><q id='kJFQh'></q></dir></style></legend>
                <i id='kJFQh'><tr id='kJFQh'><dt id='kJFQh'><q id='kJFQh'><span id='kJFQh'><b id='kJFQh'><form id='kJFQh'><ins id='kJFQh'></ins><ul id='kJFQh'></ul><sub id='kJFQh'></sub></form><legend id='kJFQh'></legend><bdo id='kJFQh'><pre id='kJFQh'><center id='kJFQh'></center></pre></bdo></b><th id='kJFQh'></th></span></q></dt></tr></i><div id='kJFQh'><tfoot id='kJFQh'></tfoot><dl id='kJFQh'><fieldset id='kJFQh'></fieldset></dl></div>
                <tfoot id='kJFQh'></tfoot>
                • 本文介绍了Android 中的垃圾收集器正在运行,但 ddms 的分配跟踪器中没有显示任何已分配的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在我的应用程序中,我注意不要在主渲染循环中进行堆分配,以防止垃圾收集器不得不做它的事情.

                  In my application, I'm careful not to make heap allocations in the main render loop, to prevent the garbage collector from having to do its thing.

                  对我的应用程序进行一系列更改后,我突然发现垃圾收集器每隔一两秒就会被调用一次,每次调用它会释放大约 400k 的内存.

                  After making a series of changes to my application, I suddenly see the garbage collector getting invoked every second or two, and it is freeing up around 400k of memory per invocation.

                  我回顾了我所做的更改,并没有在渲染线程上发生任何显式分配.所以我运行 ddms 并使用Allocation Tracker"工具,但除了与运行 ddms 相关的正常分配外,没有发生任何分配.对于显然每秒左右被垃圾收集的 400k 字节显示的分配肯定不够

                  I look back at the changes that I made, and I don't have any explicit allocations happening on the render thread. So I run ddms and use the "Allocation Tracker" tool, but there are no allocations happening, other than the normal ones that are related to running ddms. And certainly not enough allocations shown for the 400k bytes that are apparently being garbage collected every second or so

                  推荐答案

                  (我已经找到了解决方案,但我发布问题+答案是为了他人的利益)

                  (I had already found the solution but am posting the question+answer for other's benefit)

                  事实证明,我能够将问题追溯到调用枚举类的 .values() 方法,该方法会在每次调用时分配一个新数组.但是由于某种原因,这些分配没有显示在 ddms 的分配跟踪器中,因此很难追踪.

                  As it turns out, I was able to track the problem down to calling the .values() method of a enum class, which allocates a new array on every call. But for some reason, those allocations don't show up in ddms's allocation tracker, so it makes it rather difficult to track down.

                  幸运的是,我能够使用 git bisect 找到导致问题的具体更改,然后追踪到该更改中的确切问题.

                  Luckily, I was able to use git bisect to find the specific change that introduced the issue, and then tracked it down to the exact problem in that change.

                  经过一些额外的测试,似乎克隆数组一般不会出现在分配跟踪器中.

                  After some additional testing, it seems that cloning an array in general doesn't show up in the allocation tracker.

                  附加信息:克隆对象时,这似乎是 Honeycomb 及以下版本中的一个问题.它将在 ICS 中修复.(http://code.google.com/p/android/issues/detail?id=19831)

                  Additional Info: This seems to be an issue in Honeycomb and below, when cloning an object. It will be fixed in ICS. (http://code.google.com/p/android/issues/detail?id=19831)

                  这篇关于Android 中的垃圾收集器正在运行,但 ddms 的分配跟踪器中没有显示任何已分配的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How To Create a Rotating Wheel Control?(如何创建转轮控件?)
                  How to avoid restarting activity when orientation changes on Android(如何在 Android 上的方向更改时避免重新启动活动)
                  Screen orientation lock(屏幕方向锁定)
                  Strange behavior with android orientation sensor(android方向传感器的奇怪行为)
                  Android: Rotate image in imageview by an angle(Android:将imageview中的图像旋转一个角度)
                  Activity restart on rotation Android(旋转Android上的活动重启)

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

                • <legend id='G93JA'><style id='G93JA'><dir id='G93JA'><q id='G93JA'></q></dir></style></legend>
                    <bdo id='G93JA'></bdo><ul id='G93JA'></ul>

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

                        1. <tfoot id='G93JA'></tfoot>