objectbox / objectbox-swift

Swift database - fast, simple and lightweight (iOS, macOS)
https://swift.objectbox.io
Apache License 2.0
452 stars 30 forks source link

Putting too many entities will crash the app due to increased memory usage #71

Closed GeorgeIvanov closed 2 years ago

GeorgeIvanov commented 2 years ago

Describe the bug I have one main entity with 10 properties from which 5 are ToMany relations to other entities and those entities have a backlink to the main one. The other entities are quite small, around 3 properties. Saving around 1000 main entities, a total of approx 6000 entities with the secondary ones, will crash the app due to increased memory usage. The relations between the entities seem to generate leaks.

Basic info (please complete the following information):

Expected behavior Putting an increased number of entities should not crash the app.

GeorgeIvanov commented 2 years ago

The retain cycle is caused by appending objects to the backlink relation. It would be great to have a big warning sign in the documentation which states that the user should only read the backlinks.