Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-292

Memory leak when reloading the app with Results/List Object listeners

      Goals

      Use Results/List Object listeners during development of a React Native app. This requires restarting the simulator or force-closing the app on device after a certain number of reloads.

      Expected Results

      Reloading the app during development (DEV mode) should not leak.

      Actual Results

      Memory leaks when dev-reloading the app with listeners on RealmResults and List objects. It does not leak on listeners on the Realm instance.

      Steps to Reproduce

      • Call addListener on either a RealmResults object or a List object.
      • Reload the app (CMD+R)
      • See that memory climb

      Code Sample

      I created a fresh React Native app to demonstrate the issue at https://github.com/dkpalmer/realm-rn-reload-leak/. Inside App.js there are 3 cases within componentWillMount:

      Does not leak when reloading: (1) Realm listener

      Does leak when reloading: (2) Results listener and (3) List object listener

      Assuming you have the RN CLI and Xcode installed, app can be run by cloning, installing dependencies, and running react-native run-ios.

      Version of Realm and Tooling

      • Realm JS SDK Version: 2.27.0 and 2.28.0
      • Node or React Native: RN 0.59
      • Client OS & Version: iOS
      • Which debugger for React Native: DEV Perf Monitor

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: