This is a minimal example which displays some results from a mocked API to illustrate a memory leak. Every 2 seconds the model is refreshed which calls this.store.unloadAll() and this.store.findAll(). However, every API request causes about 100kb of data to be allocated in memory that is never garbage collected. This matches up with the size of the data from the API, increasing the number of fields results in more memory being consumed on every refresh request. This should not be happening as this.store.unloadAll() should free all records in the store.
routes/application.js is as follows:
refreshInterval: 2 * 1000,
model() {
this.store.unloadAll();
return this.store.findAll('boardgame')
},
autoRefreshTimer: task(function *() {
while (true) {
yield timeout(this.refreshInterval);
this.refresh();
}
}).on('init'),
});
### Versions
└─ ember-source@3.7.3
Done in 0.43s.
yarn list v1.21.1
└─ ember-cli@3.7.1
Done in 0.44s.
yarn list v1.21.1
└─ ember-data@3.7.0
To replicate the bug, clone and run in browser. https://github.com/dknz2008/ember-data-autorefresh-bug
Description
This is a minimal example which displays some results from a mocked API to illustrate a memory leak. Every 2 seconds the model is refreshed which calls
this.store.unloadAll()
andthis.store.findAll()
. However, every API request causes about 100kb of data to be allocated in memory that is never garbage collected. This matches up with the size of the data from the API, increasing the number of fields results in more memory being consumed on every refresh request. This should not be happening as this.store.unloadAll() should free all records in the store.routes/application.js is as follows: