gpt4 book ai didi

android - logcat 中的 GC_FOR_ALLOC 过多

转载 作者:行者123 更新时间:2023-11-30 02:47:58 29 4
gpt4 key购买 nike

在我的应用程序日志上运行 logcat 时,我看到很多 GC_FOR_ALLOC 而没有 GC_CONCURRENT 消息。我知道我有内存泄漏,但在堆栈和其他站点的任何地方,logcat 消息都有很多 GC_CONCURRENT 消息和很少的 GC_FOR_ALLOC 消息。我想知道我做错了什么?我的应用程序中是否存在内存泄漏的特殊情况?有什么问题?

顺便说一句:我知道 Eclipse MAT,我正在尝试使用 MAT 修复内存泄漏。我只是不知道为什么 GC_FOR_ALLOC 被如此频繁地调用。

日志:

D/dalvikvm(18068): GC_FOR_ALLOC freed 3974K, 8% free 54640K/58964K, paused 42ms, total 42ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 473K, 8% free 54622K/58964K, paused 28ms, total 28ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 139K, 7% free 55010K/58964K, paused 19ms, total 20ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 54.623MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 122K, 7% free 55071K/59032K, paused 29ms, total 29ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 54.683MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 20K, 7% free 55172K/59100K, paused 20ms, total 20ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 54.781MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 310K, 7% free 55165K/59168K, paused 18ms, total 19ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 54.774MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 485K, 7% free 55165K/59236K, paused 17ms, total 17ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 54.774MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 245K, 7% free 55365K/59304K, paused 17ms, total 17ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 54.970MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 66K, 7% free 55424K/59372K, paused 28ms, total 28ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.027MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 104K, 7% free 55568K/59440K, paused 21ms, total 21ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.167MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 47K, 7% free 55676K/59508K, paused 30ms, total 30ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.274MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 26K, 7% free 55791K/59576K, paused 24ms, total 24ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.386MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 30K, 7% free 55923K/59644K, paused 21ms, total 21ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.515MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 22K, 7% free 56048K/59712K, paused 17ms, total 18ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.636MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 611K, 7% free 55975K/59780K, paused 23ms, total 24ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.566MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 279K, 7% free 55975K/59848K, paused 20ms, total 20ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.565MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 92K, 7% free 56051K/59916K, paused 30ms, total 30ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.639MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 351K, 7% free 56272K/59984K, paused 31ms, total 31ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 25K, 7% free 56269K/59984K, paused 30ms, total 30ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.853MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 105K, 7% free 56320K/60052K, paused 19ms, total 19ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 55.902MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 526K, 7% free 56369K/60120K, paused 20ms, total 20ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 934K, 7% free 56462K/60120K, paused 19ms, total 20ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 56.041MB for 65552-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 140K, 7% free 56510K/60188K, paused 34ms, total 34ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 56.765MB for 775824-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 30K, 6% free 57414K/60948K, paused 17ms, total 17ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 57.241MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 6K, 6% free 57749K/61292K, paused 17ms, total 17ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 57.569MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed <1K, 6% free 58091K/61636K, paused 18ms, total 18ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 57.902MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed <1K, 6% free 58433K/61980K, paused 17ms, total 17ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 58.236MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed <1K, 6% free 58774K/62324K, paused 26ms, total 27ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 58.569MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed <1K, 6% free 59116K/62668K, paused 21ms, total 22ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 58.903MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed <1K, 6% free 59457K/63012K, paused 17ms, total 17ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 59.236MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed <1K, 6% free 59799K/63356K, paused 17ms, total 17ms
I/dalvikvm-heap(18068): Grow heap (frag case) to 59.570MB for 349072-byte allocation
D/dalvikvm(18068): GC_FOR_ALLOC freed 301K, 6% free 60326K/63700K, paused 25ms, total 25ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 168K, 5% free 60826K/63952K, paused 18ms, total 18ms
I/dalvikvm(18068): Jit: resizing JitTable from 4096 to 8192
D/dalvikvm(18068): GC_FOR_ALLOC freed 1166K, 5% free 61664K/64476K, paused 23ms, total 23ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 2061K, 5% free 62858K/65748K, paused 25ms, total 26ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 1867K, 4% free 64650K/67260K, paused 24ms, total 28ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 5784K, 9% free 63169K/69304K, paused 42ms, total 42ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 115K, 5% free 66326K/69304K, paused 22ms, total 24ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 6127K, 10% free 65352K/71840K, paused 53ms, total 53ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 257K, 5% free 68326K/71840K, paused 23ms, total 23ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 6537K, 10% free 67693K/74588K, paused 43ms, total 43ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 114K, 6% free 70847K/74588K, paused 22ms, total 22ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 1977K, 4% free 74341K/77420K, paused 38ms, total 38ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 2684K, 4% free 79560K/82616K, paused 48ms, total 48ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 5961K, 8% free 81482K/87804K, paused 57ms, total 62ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 3869K, 8% free 82684K/89868K, paused 50ms, total 50ms
D/dalvikvm(18068): GC_FOR_ALLOC freed 2325K, 5% free 87087K/90900K, paused 31ms, total 31ms

谢谢

最佳答案

这可能是Android堆实现的问题:

http://androidxref.com/4.4.4_r1/xref/dalvik/vm/alloc/Heap.cpp

请参阅 tryMalloc 中的注释:

There will be a lot of churn if someone allocates a bunch of big objects in a row, and we hit the frag case each time. A full GC for each.

关于android - logcat 中的 GC_FOR_ALLOC 过多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24713391/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com