MongoDB Realm with nodejs memory leak issue

Issue

We are using Realm with node.js in our product. The way we are using it is following:

const realmConfig = await Realm.open({
    path: "db_name.realm",
    schema: configurationList,
    schemaVersion: constant.appConfig.realm_schema
});

const data = clone(realmConfig.objects(schemaName));
realmConfig.close();

Even if we are closing the connection to avoid memory leak, it’s still using enormous memory (RealmObject and BSON).

I have attached memory snapshot here.

enter image description here

enter image description here

Solution

Cloning the object creates memory leak moreover opening and closing the connection multiple time creates additional overhead to the memory and creates RealmObject in the background.

enter image description here

Answered By – Raj Patel

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published