English 中文(简体)
Anders: GC_FOR_MALLOC 长时间的触摸活动造成的后果?
原标题:Android: GC_FOR_MALLOC caused by a lengthy touch event?

我在阅读和观看<代码>touchEvents时,主要因为我的GC在有 透镜/幻灯片时正在爆炸,或有许多触动活动。 如果我不打上电话,那么我从DDMS中接手的头几条<代码>GC_EXPLICIT即可看出,它只是les子。 然后,我开始对周围的屏幕和滑动,这些物体在13513个物体周围被射出,实际上造成超过100天的<代码>GC_FOR_MALLOC。 这里是我的简单测试代码,以下是“杀菌剂”的标志。 如果你有关于工作或原因的文件,或甚至可能仅仅对我进行另一次深入讨论,请<><>greatly 我们赞赏!<>。 Cheers, and well luck on You own endeavors.

[code]

    public class testClass extends Activity implements IOnSceneTouchListener{   
        int numberOfTouches = 0;        

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.main);
        }

        @Override   
        public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {                       
            numberOfTouches++;              
            return false;   
        } 

    }

<<>strong>[logcat]

06-28 15:24:55.317: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 5 objects / 128 bytes in 53ms
06-28 15:24:55.903: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 5 objects / 136 bytes in 59ms
06-28 15:24:56.708: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 5 objects / 128 bytes in 59ms
06-28 15:25:06.614: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 6 objects / 168 bytes in 58ms
06-28 15:25:09.833: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 7 objects / 192 bytes in 65ms
06-28 15:25:14.270: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 8 objects / 232 bytes in 59ms
06-28 15:25:18.294: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 6 objects / 160 bytes in 59ms
06-28 15:25:33.942: DEBUG/dalvikvm(1103): GC_FOR_MALLOC freed 13513 objects / 1403264 bytes in 121ms
06-28 15:26:53.684: DEBUG/dalvikvm(2139): GC_EXPLICIT freed 140 objects / 6960 bytes in 99ms
06-28 15:26:58.731: DEBUG/dalvikvm(1215): GC_EXPLICIT freed 668 objects / 71136 bytes in 117ms
06-28 15:27:31.637: DEBUG/dalvikvm(1103): GC_FOR_MALLOC freed 13962 objects / 1504296 bytes in 122ms
06-28 15:27:44.723: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 63 objects / 2152 bytes in 59ms
06-28 15:27:46.676: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 5 objects / 128 bytes in 65ms
06-28 15:27:47.238: DEBUG/dalvikvm(2501): GC_EXPLICIT freed 5 objects / 128 bytes in 58ms

我尚未实际解决这一问题,但对这一严重问题的伟大文章 st: rel=“nofollow” Android 问 题

[edit] as stracka said, it s most likely due to flooding. My real issue is however with the allocations that are being made on each event? Is there a way to reuse these events/objects to limit allocations due to touch?

I m currently using andEngine, and the touchEvents are pooled so there should be at most ~5 ever allocated from scratch; otherwise they just reuse don t they?

感谢任何想法......。

问题回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...