-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requesting more memory than is currently allowed for backlink array due to memory allocation logic for links. #6577
Comments
After some investigations I found out in this code
|
Hello, thanks for reporting this, this issue is definitely very similar to #6531 ... I haven't found a way to reproduce it yet, thus we still don't have a fix for it. |
It's not pasted twice. This appeares on the console. |
OK, this should not be possible. I hope to be able to reproduce it and fix it soon. |
I was able to reproduce this in a unit test. We are requesting more memory than is currently allowed in a single array due to the constraint of having to make it fit in a single mapping. The array growing is the backlink array with size of 8388608, and width of 32. The DB is around 100Mb. The
|
➤ jedelbo commented: I will have a look at this. |
@Cliff-F unfortunately we have a limit in our implementation that limits the number of backlinks to a given object to 8388606. This means that you can only have so many objects linking to one specific object. We can change the implementation so that we don't have this limit, but it will be a file format breaking change, and we don't want to create too many of those. So I cannot promise that this can be done soon enough to solve your problem. Apart from the fact that this actually makes your program crash, it must also cause some performance issues. Could you perhaps change your design so that you instead of linking to that object stored an id for the object? |
Fixed by #6673 |
SDK and version
SDK : Realm Swift for Mac
Version: 10.39.0 (realm-core-13.10.0)
Observations
Crash log / stacktrace
Steps & Code to Reproduce
I posted #6531. This may be related or may be not. This crash occurs in a different situation.
This program for Mac that we are developing reads 60,000+ local xml files, analyzes them, and builds a realm database that will have 20,000,000+ records. The program continuously reads/writes the database from multiple threads at almost 100% cpu usage for 5-6 hours. After several hours when 80% of the tasks have finished, the program crashes at
realm.add(obj)
. The memory usage is modest (500MB-2GB, running on 16GB MacBook Pro). The realm file is not broken. All the records we are trying to add to the database are not ususual. (after the crash, we can continue analyzing and adding the remaining records to the database when restarted.)The text was updated successfully, but these errors were encountered: