remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
53.16k stars 10.31k forks source link

Memory leak with basic usage. #3900

Closed pauldotknopf closed 8 years ago

pauldotknopf commented 8 years ago

Using the example "sidebar", I added this code to test the memory leak.

var current = false;

var flop = function() {
  if(current) {
    browserHistory.push('/sidebar/category/Burgers/Buffalo%20Bleu');
  } else{
    browserHistory.push('/sidebar/category/Burgers/Mushroom%20and%20Swiss')
  }

  current = !current;

  setTimeout(flop, 100);
}

setTimeout(flop, 100);

After about 3 minutes of running, my heap size has grown 1MB.

I have ran a very similar test using router5-react and the heap size stayed stable.

timdorr commented 8 years ago

That points to the underlying history library, not something within the router. I would open an issue there and test against the latest version to be sure.

pauldotknopf commented 8 years ago

I don't think that is the case. I replaced the browser history with the "in-memory" history, and same result.

Here is more info.

image