A program crashes due to high resource consumption caused by the Android while loop

Source: Internet
Author: User

Timeline:activity_launch_request time:65620
04-14 15:31:25.347:I/DALVIKVM (3483): Total arena pages for jit:11
04-14 15:31:25.621:D/DALVIKVM (3483): JIT Unchain all for threadid=13
04-14 15:31:26.371:W/DALVIKVM (3483): Threadid=1:spin on suspend #1 threadid=13 (pcf=0)
04-14 15:31:27.122:W/DALVIKVM (3483): Threadid=1:spin on suspend #2 threadid=13 (pcf=0)
04-14 15:31:27.122:I/DALVIKVM (3483): "Main" prio=5 tid=1 RUNNABLE

JIT Unchain All for threadid=19

04-14 15:33:28.638:W/DALVIKVM (5595): Threadid=20:spin on suspend #1 threadid=19 (pcf=0)
04-14 15:33:29.388:W/DALVIKVM (5595): Threadid=20:spin on suspend #2 threadid=19 (pcf=0)
04-14 15:33:29.388:I/DALVIKVM (5595): "Pool-5-thread-2" prio=5 tid=20 RUNNABLE

Call while (!iscomplete) multiple times while running the application; Blocking threads, causing thread resource consumption to be high. Modify the implementation method to reduce resource consumption

while (!iscomplete) {

try {

Thread.Sleep (100);
} catch (Interruptedexception e) {
TODO auto-generated Catch block
LOG.E (e);
}
Continue

}

A program crashes due to high resource consumption caused by the Android while loop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.