adriancarriger / angularfire2-offline

🔌 A simple wrapper for AngularFire2 to read and write to Firebase while offline, even after a complete refresh.
https://angularfire2-offline.firebaseapp.com/
MIT License
207 stars 48 forks source link

Memory leak #72

Open peter-o opened 7 years ago

peter-o commented 7 years ago

I'm currently implementing Ionic2 app with this wrapper and it seems to cause issues with memory usage (fully explained here: https://stackoverflow.com/questions/46086610/ionic2-angularfire2-offline-memory-leak) It looks like every update of the object on the list increases the memory usage by over 1MB which leads to memory leak and app crash on android device. I'm updating each item using following code: this.db.object("/path/to/list/objectKey").update(newData); At the same time, I have a list (AfoListObservable) displayed on the screen with async pipe so I'm not sure if the issue is caused by the update itself or because the list is refreshed. The list is created like this: var list = this.db.list("/path/to/list") The list is not huge (~40 objects when I tested it) but the app can easily use over 100MB after just a few minutes of using it (strting from ~35MB). Has anyone experienced similar issues before?

larssn commented 6 years ago

The async pipe has had memory leaks in the past, I'd try and rule that out as well.

peter-o commented 6 years ago

The problem is that it works fine when I don't use the offline wrapper.

larssn commented 6 years ago

So simply using angularfire2 and there's no memory problems?

peter-o commented 6 years ago

Yes.

AnkitMaheshwariIn commented 6 years ago

@peter-o without the offline wrapper means..? Please explain I'm facing same issue!

peter-o commented 6 years ago

There is not much to explain - I haven't resolved that issue yet. Basically, everything works fine until I add angularfire2-offline so it just confirms that the memory leak is not caused by any other component in my project. Let me know if you find the solution - I'll have to get back to it pretty soon, so any tips are very welcome.