apache / apache/pouchdb

Find keeps query objects in heap memory

Open
#8,833 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.6k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Issue
I have a table that has several documents that reach close to 2mb ~ 4mb and I use the find method to search just some fields in these documents and with some specific filters. I always work with creating indexes for these queries and it all works very well.

Recently I have noticed a significant increase in the application's memory consumption in some processes and they all involve the find method.

It seems that even after the promise is completed, the objects that the library uses maintains the connection with the object in memory, preventing the garbage collector from removing these objects.

Only after a new query is executed are the objects "released" and the garbage collector can do its work.

![image](https://github.com/pouchdb/pouchdb/assets/1148089/6abbfccf-fc03-4e1b-99a8-b8ba304c8de8)

### Info
- Environment: Browser, AngularJS, PouchDB 7.2.1
- Platform: Chrome
- Adapter: indexeddb
- Server: CouchDB

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.