Eclipse的LogCat充斥着带有android的WAIT

编程入门 行业动态 更新时间:2024-10-23 11:23:31
Eclipse的LogCat充斥着带有android的WAIT_FOR_CONCURRENT_GC(Eclipse's LogCat gets flooded with WAIT_FOR_CONCURRENT_GC with android)

我正在写一个小型安卓游戏,每当我第一次运行时,一切都运行良好,但它会随机挂起并开始在eclipse的LogCat中无休止地发送垃圾邮件

12-30 12:40:05.344:D / dalvikvm(22831):WAIT_FOR_CONCURRENT_GC阻塞5ms 12-30 12:40:05.383:D / dalvikvm(22831):GC_CONCURRENT释放511K,34%免费2374K / 3552K,暂停1ms + 2ms ,总共14ms

我知道它与垃圾收集有关,但每当我强制停止应用程序(关闭它的唯一方法)时,我会丢失大约5-10mb的可用内存,直到我重新启动设备。 有谁知道这意味着什么以及如何预防?

我正在使用的设备是运行android 4.2.1(Cyanogenmod 10.1)的verizon galaxy nexus和3.2(api level 13)的sdk / target版本。 谢谢!

I am writing a small android game, and whenever I first ran, everything worked fine, but it will randomly hang and start spamming this endlessly in eclipse's LogCat

12-30 12:40:05.344: D/dalvikvm(22831): WAIT_FOR_CONCURRENT_GC blocked 5ms 12-30 12:40:05.383: D/dalvikvm(22831): GC_CONCURRENT freed 511K, 34% free 2374K/3552K, paused 1ms+2ms, total 14ms

I know it has something to do with garbage collecting, but whenever I force stop the app(the only way to close it) I lose around 5-10mb of available ram until I restart the device. does anyone know what this means and how to prevent it?

the device I am using is a verizon galaxy nexus running android 4.2.1(Cyanogenmod 10.1) and sdk/target version at 3.2(api level 13). Thanks!

最满意答案

您将能够以自己的方式进入更详细的描述,但基本上它只是意味着您正在使垃圾收集器非常努力。

编程游戏不同于编写“普通”应用程序:您的游戏可能无数循环。 因此,即使是微小的内存泄漏也会迅速增长,成为一个真正的问题。

此外,GC也是你最大的朋友,在游戏中它几乎是你的敌人之一。 每次GC运行都会产生一些冻结,因为它“阻止了世界”。

我建议你继续搜索特定的游戏编程教程,以及如何在这些教程中对抗GC。

You'll be able to Google your way into a much more detailed description, but basically it just means you're making the garbage collector work very hard.

Programming a game is different from programming a 'normal' app: your game probably loops countless of times. As a result of this even a tiny memory leak can grow quickly to a real problem.

Furthermore, GC is normall your biggest friend, in gaming it is pretty much one of your enemies. Every GC run creates a little freeze since it 'stops the world'.

I'd suggest you continue your search in specific gaming programming tutorials and how to work against the GC in those.

更多推荐

本文发布于:2023-08-06 03:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1444443.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:LogCat   Eclipse   WAIT   android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!