5

----EDIT the question was to long and to hard to understand------

Here is a working exemple : http://codepen.io/anon/pen/Mwapgb WARNING : This will make firefox CRASH ! , if you dare, click around 500 time on any div (i suggest to use a tool to simulate it. Rip mouse)

But This http://codepen.io/anon/pen/eNNqde Wont make firefox crash

What is the difference :

function GetDateFromDatetimePython(stringdate){ // IT CRASH
    var partieDate = stringdate.split(' ');
    var ymd = partieDate[0].split('-');
    var hms = partieDate[1].split(':');
    return new Date(Date.UTC(ymd[0],ymd[1]-1,ymd[2],hms[0],hms[1],hms[2],0));
}

function GetDateFromDatetimePython(stringdate){ // IT DON'T

    var partieDate = stringdate.split(' ');
        var tmp = partieDate[0];    //  add this
        var tmp2 = partieDate[1];   //  add this
    var ymd = tmp.split('-');       //  change this
    var hms = tmp2.split(':');     //  change this
    return new Date(Date.UTC(ymd[0],ymd[1]-1,ymd[2],hms[0],hms[1],hms[2],0));
}

I'm going crazy. What is wrong with the first practice ?

Ok , it's stupid to make 3 split, i could combined in 1 . Whenever. WHY does this blow up firefox , Why aren't Chrome nor IE affect ?

ssbb
  • 1,921
  • 2
  • 21
  • 42
  • I'm curious... what exactly do you do when you say `other tricks`? Are these memory or CPU intensive tricks? – alex Apr 29 '15 at 15:42
  • @alex more often it crash when i click on the div
    – ssbb Apr 29 '15 at 15:43
  • Something in that function is performance heavy probably. Are you doing some serious looping? A code snippet of that function would be very helpful. – alex Apr 29 '15 at 15:45
  • Add displayBox Code. I try to remove the animate and make a basic ng-show/ng-hide but same issue. – ssbb Apr 29 '15 at 15:49
  • What if you just remove all the code in the function and just add, `alert('test');`. Limit your result set so it's not 150 vehicles, but 2 or 3. Also, please rule out that this is actually a code issue and not a browser/local setup issue with Firefox. I would guess it's more likely to be your browser than actual code seeing as it works in Chrome (and especially, IE). [See this link for memory usage in FF](https://support.mozilla.org/en-US/kb/firefox-uses-too-much-memory-ram). Test on a different machine that uses FF if possible? – alex Apr 29 '15 at 15:52
  • I didn't describ the problem correctly, it doesn't appear on the first click. It appear if i clique for around 60 times. This value change everytime . Sometime it's 30 click others it's around 100. I test with an other FF on a other computer. Same problem So I expect it's my code issue. – ssbb Apr 29 '15 at 15:56
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/76555/discussion-between-alex-and-ssbb). – alex Apr 29 '15 at 15:58

1 Answers1

0

May be you are trapped into some infinite loop or a process is instantiated which involves heavy processing which drains all the memory available with your browser.

Ashish_B
  • 114
  • 1
  • 9
  • well , i give quite all the function, i didn't find any loop case involve. Whenever , why could it happend at the 60th click and not before? :s – ssbb May 04 '15 at 07:28
  • can you please elaborate the use of $scope.timeout here.. as I can not find any such variable in your html code – Ashish_B May 04 '15 at 07:37
  • well , it's just a interger value between 300 & 900. Here is 600. – ssbb May 04 '15 at 07:39