You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pouchdb-abstract-mapreduce module is keeping a reference to data that should be garbage collected which results in much higher memory usage depending on how many views you define in your application
The module defines the persistentQueues object which stores instances of the TaskQueue class.
When a view is queued to be updated or a view is queried it ensures there is a TaskQueue instance for that view and uses it to ensure that the view only has a single operation running at any time
The TaskQueue class stores a promise and whenever a new operation is added it replaces the promise with a new one
add(promiseFactory){this.promise=this.promise.catch(function(){// just recover}).then(function(){returnpromiseFactory();});returnthis.promise;}
The new promise retains the return value of promiseFactory() which keeps it in memory until add() is called again
Unfortunately you would still have to update the codebase to ensure that TaskQueue.finish() is always called when you have queued all the tasks and want to get the return value
Info
Environment: browser
Platform: Chrome
Adapter: idb
Server: None (exclusively local data)
Reproduce
Create a design document which has a view
Query the view
Drop the return value
Take a heap snapshot in the memory inspector of Chrome developer tools
The text was updated successfully, but these errors were encountered:
Issue
The
pouchdb-abstract-mapreduce
module is keeping a reference to data that should be garbage collected which results in much higher memory usage depending on how many views you define in your applicationThe module defines the
persistentQueues
object which stores instances of theTaskQueue
class.When a view is queued to be updated or a view is queried it ensures there is a
TaskQueue
instance for that view and uses it to ensure that the view only has a single operation running at any timeThe
TaskQueue
class stores a promise and whenever a new operation is added it replaces the promise with a new oneThe new promise retains the return value of
promiseFactory()
which keeps it in memory untiladd()
is called againIf you updated the
finish()
method fromto
Then calling
finish()
would release the memoryUnfortunately you would still have to update the codebase to ensure that
TaskQueue.finish()
is always called when you have queued all the tasks and want to get the return valueInfo
Reproduce
The text was updated successfully, but these errors were encountered: