×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jun 2009
    Location
    London
    Posts
    50

    ALERT: Bad dynamic heap objects found or ALERT: Invalid heap pointer found

    I keep getting one of these two alerts whenever I try to run a MIDlet on the emulator and the emulator crashes. This happens only when a specific part of the code is executed. What does it mean and how can i resolve it?

    I believe it has something to do with the images that i am using but i am not sure. 90% of the times It crashes from the first attempt to execute the specific code but some other times it executes the code well once or twice in a row and crashes on the next attempt.

    I get something like this

    Code:
    Method............: 10230c4c 'com/sun/midp/io/ResourceInputStream.<init> (virtual)' 
    Stack Chunk.......: 3e3bfd0
    Frame Pointer.....: 3e3c088
    Current IP........: 103379cd = 103379a5 + offset 40
    Previous Frame....: 3e3c060
    Previous IP.......: 10369ef0 (offset 83)
    Frame size........: 3 (2 arguments, 1 local variables)
    Argument[0].......: 3d39cb4
    Argument[1].......: 3d39cd8
    Local[2]..........: 3d39ba4
    Operand[1]........: 3d39cb4
    Operand[2]........: 3d39cb4
    Operand[3]........: 3d39b78
    
    Method............: 10253f84 'java/lang/Class.getResourceAsStream (virtual)' 
    Stack Chunk.......: 3e3bfd0
    Frame Pointer.....: 3e3c060
    Current IP........: 10369ef0 = 10369e9d + offset 83
    Previous Frame....: 3e3c038
    Previous IP.......: 1034ce40 (offset 14)
    Frame size........: 4 (2 arguments, 2 local variables)
    Argument[0].......: 103decc4
    Argument[1].......: 3d39cd8
    Local[2]..........: 1034ce36
    Local[3]..........: 3e3c04c
    Operand[1]........: 3d39cb4
    
    Method............: 102415e8 'javax/microedition/lcdui/ImmutableImage.<init> (virtual)' 
    Stack Chunk.......: 3e3bfd0
    Frame Pointer.....: 3e3c038
    Current IP........: 1034ce40 = 1034ce32 + offset 14
    Previous Frame....: 3e3c010
    Previous IP.......: 10329b6a (offset 8)
    Frame size........: 3 (2 arguments, 1 local variables)
    Argument[0].......: 3d39cf0
    Argument[1].......: 3ec9c0c
    Local[2]..........: 0
    
    Method............: 10226fdc 'javax/microedition/lcdui/Image.createImage (static)' 
    Stack Chunk.......: 3e3bfd0
    Frame Pointer.....: 3e3c010
    Current IP........: 10329b6a = 10329b62 + offset 8
    Previous Frame....: 3e3bff0
    Previous IP.......: 3ec9843 (offset 7)
    Frame size........: 2 (1 arguments, 1 local variables)
    Argument[0].......: 3ec9c0c
    Local[1]..........: 3d39d08
    Operand[1]........: 3d39cf0
    and then

    Code:
    VM status:
    Instruction pointer.: 103379cd (offset within invoking method: 40)
    Next instruction....: 0xce
    Frame pointer.......: 3e3c088
    Local pointer.......: 3e3c07c
    Stack size..........: 256; sp: 3e3c0a8; ranges: 3cd0af8-3cd0cf8;3e3bfd8-3e3c1d8;
    Contents of the current stack frame:
        3e3c07c: 3d39cb4 (lp)
        3e3c080: 3d39cd8
        3e3c084: 3d39ba4
        3e3c088: 3e3c060 (fp)
        3e3c08c: 10369ef0
        3e3c090: 3e3c078
        3e3c094: 10230c4c
        3e3c098: 3e3bfd0
        3e3c09c: 0 (end of frame)
        3e3c0a0: 3d39cb4
        3e3c0a4: 3d39cb4
        3e3c0a8: 3d39b78 (sp)
    Execution stack contains 724 items: 
    3cd0e30  
    0  
    0  
    0  
    0  
    0  
    0  
    ffffffff  
    ffffffff  
    ffffffff  
    ffffffff  
    0  
    1  
    3cd0de0  
    0  
    0  
    0  
    1  
    3e4ffa4  
    10250940  
    3cd0af0  
    0  
    3cd0e30  
    1  
    1  
    3cd0b38  
    10367144  
    3cd0b4c  
    10250960  
    3cd0af0  
    0  
    3cd0e4c  
    1  
    0  
    fffffffb  
    3cd0b5c  
    103673c9  
    3cd0b5c  
    103673d2  
    3cd0b70  
    1023dd24  
    3cd0af0  
    0  
    3cd0e4c  
    1  
    0  
    fffffffb  
    3cd0e40  
    0  
    3cd0de0  
    3cd0af0  
    3cd0b8c  
    10349002  
    3cd0ba0  
    1021c868  
    3cd0af0  
    0  
    3cd12d0  
    1  
    fffffffb  
    3cd0bc4  
    1031baac  
    3cd0bd8  
    10229974  
    3cd0af0  
    0  
    3ce0a2c  
    1  
    fffffffb  
    3ce2720  
    0  
    3cd17ec  
    3cd0af0  
    3cd0be8  
    1032e8ac  
    3cd0bfc  
    102617cc  
    3cd0af0  
    0  
    3ce2720  
    fffffffb  
    3ce2720  
    3cd17e0  
    1028ccd0  
    3cd0af0  
    3cd0c1c  
    1037bb92  
    3cd0c30  
    1029013c  
    3cd0af0  
    0  
    3ce2720  
    3cd052c  
    3ce2720  
    3d39d30  
    3cd0c4c  
    103c6527  
    3cd0c60  
    3ecadd0  
    3cd0af0  
    0  
    3ce0ac8  
    3ecae58  
    3ecae58  
    3cd0c74  
    3ecaccc  
    3cd0c88  
    3ecdf28  
    3cd0af0  
    0  
    3ce1f38  
    ffffffff  
    3cd0cac  
    3cd0c98  
    3ecd5fc  
    3cd0cac  
    3ec9aa8  
    3cd0af0  
    0  
    3ce1f38  
    40408000  
    3eab367a  
    40414b57  
    13  
    3ce25b8  
    0  
    0  
    0  
    3ce1f38  
    0  
    c  
    3d39d08  
    0  
    3cd0c98  
    3cd0cbc  
    3ec9919  
    3cd0cd0  
    3ec9ac8  
    3e3bfd0  
    0  
    3ec9c0c  
    3d39d08  
    3e3bff0  
    3ec9843  
    3e3c004  
    10226fdc  
    3e3bfd0  
    0  
    3d39cf0  
    3d39cf0  
    3ec9c0c  
    0  
    3e3c010  
    10329b6a  
    3e3c028  
    102415e8  
    3e3bfd0  
    0  
    103decc4  
    3d39cd8  
    1034ce36  
    3e3c04c  
    3e3c038  
    1034ce40  
    3e3c04c  
    10253f84  
    3e3bfd0  
    0  
    3d39cb4  
    3d39cb4  
    3d39cd8  
    3d39ba4  
    3e3c060  
    10369ef0  
    3e3c078  
    10230c4c  
    3e3bfd0  
    0  
    3d39cb4  
    3d39cb4  
    3d39b78  
    
    Execution completed.
    143082966 bytecodes executed
    3421 thread switches
    1691 classes in the system (including system classes)
    89053 dynamic objects allocated (5434716 bytes)
    27 garbage collections (3489856 bytes collected)
    Execution completed.
    143082966 bytecodes executed
    3421 thread switches
    1691 classes in the system (including system classes)
    89053 dynamic objects allocated (5434716 bytes)
    27 garbage collections (3489856 bytes collected)
    ALERT: Bad dynamic heap objects found
    ricoh-run:
    semc-icon-assembly:
    semc-ppro-emulator:
    semc-do-run:
    semc-run:
    savaje-run:
    sjmc-run:
    nokiaS80-run:
    nsicom-run:
    bdj-run:
    run:

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: ALERT: Bad dynamic heap objects found or ALERT: Invalid heap pointer found

    Hello polys,

    I try to run a MIDlet on the emulator and the emulator crashes.
    Which emulator this is about?

    This happens only when a specific part of the code is executed
    Could you please elaborate more on this code? You mentioned on fetching pics (based on the logs this would be the case, however more info is required for analysis.)

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Regular Contributor
    Join Date
    Jun 2009
    Location
    London
    Posts
    50

    Re: ALERT: Bad dynamic heap objects found or ALERT: Invalid heap pointer found

    Quote Originally Posted by r2j7 View Post
    Which emulator this is about?
    I am using the DefaultColorPhone of WTK 2.5.2 for CDLC


    Quote Originally Posted by r2j7 View Post
    Could you please elaborate more on this code? You mentioned on fetching pics (based on the logs this would be the case, however more info is required for analysis.)
    r2j7
    gpsCom check in which botanical division of Cypurs the user is located in. I am using a map which is separated into 8 divisions, each with a different color
    Code:
    public void gpsCom(){
            Runtime.getRuntime().freeMemory();
            int division = divisionFinder.getDivision();
            
            if (division == -1) {
                Alert gps = new Alert("GPS Command", "The botanical division you are located in has not yet been identified.", null, AlertType.INFO);
                gps.setTimeout(2000);
                display.setCurrent(gps, mainList);
            }
            else if (division == -2) {
                Alert gps = new Alert("GPS Command", "You are not located in any botanical division of Cyprus.", null, AlertType.INFO);
                gps.setTimeout(2000);
                display.setCurrent(gps, mainList);
            }
            else{            
                divisionSelected = division;
                GPSLocationForm gpsLocationForm = new GPSLocationForm (this, divisionSelected);
                display.setCurrent(gpsLocationForm);
            }
        }
    The value of the corresponding pixel of the map is checked to define which division the user is located in.

    Inise divisionFinder Class:
    Code:
    public int getDivision () {
            int division = -1;        
            if (latitude_N == 0 && longitude_E == 0)
                return -1;
            if (latitude_N < minLatitude || latitude_N > maxLatitude ||
                    longitude_E < minLongitude || longitude_E > maxLongitude){
                return -2;
            }
            else {
                int[] p = readImagePixel();
                if (p[1] > 110 && p[1]<130)
                    p[1] = 123;
                if (p[0] == 0 && p[1] == 123 && p[2] == 255)
                    division = 1;
                else if (p[0] == 255 && p[1] == 123 && p[2] == 0)
                    division =  2;
                else if (p[0] == 0 && p[1] == 123 && p[2] == 0)
                    division =  3;
                else if (p[0] == 255 && p[1] == 123 && p[2] == 255)
                    division =  4;
                else if (p[0] == 255 && p[1] == 255 && p[2] == 0)
                    division =  5;
                else if (p[0] == 255 && p[1] == 0 && p[2] == 0)
                    division =  6;
                else if (p[0] == 0 && p[1] == 255 && p[2] == 0)
                    division =  7;
                else if (p[0] == 0 && p[1] == 0 && p[2] == 255)
                    division =  8;
                else if (p[0] == 255 && p[1] == 255 && p[2] == 255)
                    division = -2;
            }
            return division;
        }
        
        public int[] readImagePixel () {                
            Image map = null;
            try {
                map = Image.createImage("/PlantIdentification/map.png");
            } catch (IOException ex) {
                ex.printStackTrace();
            }
    
            int pixel_x = (int)(((longitude_E - minLongitude) / difLongitude) * (double)map.getWidth());
            int pixel_y = (int)((double)map.getHeight() - ((latitude_N - minLatitude) / difLatitude) * (double)map.getHeight());
    
            int[] colorTable = new int[1];
            try {
                map.getRGB(colorTable, 0, map.getWidth(), pixel_x, pixel_y, 1, 1);
            } catch (Exception ex) {
                ex.printStackTrace();
            }        
            int[] pixel = new int[3];
            pixel[0] = (int)((colorTable[0]&0x00FF0000)>>>16); //Red
            pixel[1] = (int)((colorTable[0]&0x0000FF00)>>>8); //Green
            pixel[2] = (int)(colorTable[0]&0x000000FF); //Blue
            return pixel;
        }
    The problem occurs when i execute this code starting from gpsCom().

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: ALERT: Bad dynamic heap objects found or ALERT: Invalid heap pointer found

    This may simply be a bug in the emulator. I suggest you upgrade to Java Platform Micro Edition Software Development Kit 3.0.

    Graham.

Similar Threads

  1. How to create a sis using ensymble and Python 1.9.4 ?
    By marcelobarrosalmeida in forum Symbian
    Replies: 10
    Last Post: 2009-05-27, 10:16
  2. Invalid Heap Object Found / Circular GC Invocation!
    By charlie_pence@hotmail.com in forum Mobile Java General
    Replies: 1
    Last Post: 2008-02-24, 16:07
  3. Bad dynamic heap objects found!
    By iecomdev in forum Mobile Java General
    Replies: 4
    Last Post: 2007-11-06, 15:50
  4. Prototype SDK 2.0 setup problem
    By jackmcardle in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2007-01-09, 16:21
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •