Closed ctwong11 closed 11 years ago
I would actually cache the object, so that I reuse the same object store everytime. Infact, I would even use an explicit transaction and object store ... something like this
var o = $.indexedDB("ABC").objectStore("DEF");
for(var i=0;i<10000;i++)
{
o.add(item).done(function () {
console.log("added item to indexedDB");
});
}
Would love to see your data on how the memory seems to increases in both cases ... .are you using a heap profile on Chrome ?
Thanks axemclion.
I ran your code but it doesn't help much. The easiest way to observe the problem is open up windows task manager then bring up the memory usage screen. You could see the memory is consumed during the execution of the for loop. However, it wont release back to system after the completion of the for loop.
best, ct
Can you also add information about the Browser used, the version and any other details. I was looking at chrome using the chrome profiler.
i am using google chrome version 22.0.1229.79 m
I created a brand new project and a simple indexedDB. Then ran your code:
var o = $.indexedDB("ABC").objectStore("DEF"); for(var i=0;i<10000;i++) { o.add(item).done(function () { console.log("added item to indexedDB"); }); }
By observing at windows task manager, the memory bar went up once the for loop is called. However, it never go down unless you close the chrome browser window.
I then ran a chrome profiler -> heap stack snapshot -> capture before "for loop" profile + capture after "for loop" profile -> click comparsion mode. You can see some new system objects and array is created without deletion.
Best, ct
hi axemclion,
any follow up on this issue?
best, ct
Looking at it now. Planning to fix this over the week end.
I am trying to compare this against writing IndexedDB using the native API, not able to see the difference. Can you attach the heap shots so that we can analyze it ?
Closing issue as no additional data was available to debug, and issue could not be reproduced
hi!
I am using the plugin to add a high volume of records into the indexedDB. However, I found a memory leak issue when use the "add" function.
e.g.
for(var i=0;i<10000;i++) { $.indexedDB("ABC").objectStore("DEF").add(item).done(function () { console.log("added item to indexedDB"); }); }
It takes up a chunk of memory and never release back to the system. I ran a chrome heap stack profile snapshot and i saw it created a lot of new objects which did not being deleted after the operation. Did i use the plug in wrongly? Any problem of my syntax?
Best, ct