[SOLVED] Webkit CRASH when calculating data from XML file



  • Hi,

    I have problem with long function. On simulator it's working but on device it says:

    @
    Thread has crashed: Thread 0x60e has panicked. Category: Webkit CRASH; Reason: 0
    Thread has crashed: Thread 0x60f has panicked. Category: Webkit CRASH; Reason: 0
    @

    This is my JavaScript file:
    @
    function prepocet(pole_meny) {
    var select1 = shortcut1.text;
    var value = value1.text;
    var sum1 = 0;

    switch(select1) {
    case "USD":
            czk. kurz = Math.round(pole_meny[32]*1000)/1000;
                    m6593.kurz = Math.round(( pole_meny[32] / pole_meny[0])*1000)/1000;
                    m6504.kurz = Math.round(( pole_meny[32] / pole_meny[1])*1000)/1000;
                    m6472.kurz = Math.round(( pole_meny[32] / pole_meny[2])*1000)/1000;
                    m6506.kurz = Math.round(( pole_meny[32] / pole_meny[3])*1000)/1000;
                    m6595.kurz = Math.round(( pole_meny[32] / pole_meny[4])*1000)/1000;
                    m6596.kurz = Math.round(( pole_meny[32] / pole_meny[5])*1000)/1000;
                    m6491.kurz = Math.round(( pole_meny[32] / pole_meny[6])*1000)/1000;
                    m6509.kurz = Math.round(( pole_meny[32] / pole_meny[7])*1000)/1000;
                    m6473.kurz = Math.round(( pole_meny[32] / pole_meny[8])*1000)/1000;
                    m6508.kurz = Math.round(( pole_meny[32] / pole_meny[9])*1000)/1000;
                    m6577.kurz = Math.round(( pole_meny[32] / pole_meny[10])*1000)/1000;
                    m6510.kurz = Math.round(( pole_meny[32] / pole_meny[11])*1000)/1000;
                    m6597.kurz = Math.round(( pole_meny[32] / pole_meny[12])*1000)/1000;
                    m6578.kurz = Math.round(( pole_meny[32] / pole_meny[13])*1000)/1000;
                    m6583.kurz = Math.round(( pole_meny[32] / pole_meny[14])*1000)/1000;
                    m6598.kurz = Math.round(( pole_meny[32] / pole_meny[15])*1000)/1000;
                    m6579.kurz = Math.round(( pole_meny[32] / pole_meny[16])*1000)/1000;
                    m6512.kurz = Math.round(( pole_meny[32] / pole_meny[17])*1000)/1000;
                    m6599.kurz = Math.round(( pole_meny[32] / pole_meny[18])*1000)/1000;
                    m6580.kurz = Math.round(( pole_meny[32] / pole_meny[19])*1000)/1000;
                    m6513.kurz = Math.round(( pole_meny[32] / pole_meny[20])*1000)/1000;
                    m6600.kurz = Math.round(( pole_meny[32] / pole_meny[21])*1000)/1000;
                    m6601.kurz = Math.round(( pole_meny[32] / pole_meny[22])*1000)/1000;
                    m6475.kurz = Math.round(( pole_meny[32] / pole_meny[23])*1000)/1000;
                    m6476.kurz = Math.round(( pole_meny[32] / pole_meny[24])*1000)/1000;
                    m6575.kurz = Math.round(( pole_meny[32] / pole_meny[25])*1000)/1000;
                    m6514.kurz = Math.round(( pole_meny[32] / pole_meny[26])*1000)/1000;
                    m6581.kurz = Math.round(( pole_meny[32] / pole_meny[27])*1000)/1000;
                    m6527.kurz = Math.round(( pole_meny[32] / pole_meny[28])*1000)/1000;
                    m6592.kurz = Math.round(( pole_meny[32] / pole_meny[29])*1000)/1000;
                    m6515.kurz = Math.round(( pole_meny[32] / pole_meny[30])*1000)/1000;
                    m6585.kurz = Math.round(( pole_meny[32] / pole_meny[31])*1000)/1000;
                    m6591.kurz = Math.round(( pole_meny[32] / pole_meny[32])*1000)/1000;
                    m6594.kurz = Math.round(( pole_meny[32] / pole_meny[33])*1000)/1000;
            sum1 = value * pole_meny[32];
            break;
    case "EUR":
        ... // the same code with different values
        break;
    ...
    

    @

    This function has 35 identical "cases" with different values​​.
    I tried to set TARGET.EPOCHEAPSIZE = 0xF00000 0x2000000 but it doesn't work.



  • It's a guess, because I don't know if your variables like m6593, m6504 etc. are declared locally at the time they are used in that function and I don't know how your 'cases' differ from each other:

    Try to split up your big function into 35 smaller functions, so that each small function handles one 'case'. This would also make the code cleaner. It could be (but I am not sure here) that then not so much memory is used, because a smaller function needs less symbols than the big one.

    Maybe this link will help to understand the memory management when a function is called: "objects in javascript":http://stackoverflow.com/questions/3691125/objects-in-javascript

    Let us know if this helps or not.



  • Yes, it's working. Thank you very much!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.