-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
<!---
Questions: If you have questions about HOW TO use Realm, please ask on
StackOverflow: http://stackoverflow.com/questions/ask?tags=realm
We monitor the realm tag.
Feature Request: Just fill in the first two sections below.
Bugs: To help you as fast as possible with an issue please describe your issue
and the steps you have taken to reproduce it in as much detail as possible.
-->
Goals
I'm trying to insert a lof of (>300k) objects into Realm.
<!--- What are you trying to achieve? -->
Expected Results
Objects get batched into Realm successfully.
<!--- What did you expect to happen? -->
Actual Results
After about 150k of objects, Realm crashes with a cryptic message that doesn't reference Realm directly but it is most likely the culprit.
<!--- What happened instead? -->
<!--- e.g. the stack trace of a crash -->
2020-01-14 15:13:05.214 5863-13164/com.my.app E/unknown:ReactNative: Exception in native call com.facebook.jni.CppException: Malformed calls from JS: field sizes are different. [[33],[3],[],1331] at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:907) at android.os.Handler.dispatchMessage(Handler.java:105) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) at android.os.Looper.loop(Looper.java:216) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232) at java.lang.Thread.run(Thread.java:784)
After opening up the app again, I get an mmap() out of memory error right on initialization of realm and have to remove everything (only thing that works is Realm.clearTestState())
Steps to Reproduce
It happens to me when i batch insert a lot of data into multiple Realm instances. Is there anything I'm doing wrong?
Code Sample
const FeatureSchema = { name: "Feature", primaryKey: "identifierHash", properties: { geohash: { type: "string", indexed: true }, layerName: "string", identifierHash: { type: "string", indexed: true }, data: "string" } } for (let batchIdx = 1; batchIdx <= batches; batchIdx++) { .... loading data let realm = await Realm.open({ schema: [FeatureSchema] }) realm.beginTransaction() features.map(feature => { realm.create( FeatureSchema.name, { geohash, layerName: feature.layerName, identifierHash: feature.properties.identifierHash, data: JSON.stringify(feature) }, true ) }) realm.commitTransaction() console.tron.log("Total features after batch", realm.objects(FeatureSchema.name).length) realm.close() }
Version of Realm and Tooling
- Realm JS SDK Version: 4.0.0-beta.0
- Node or React Native: React Native 0.59
- Client OS & Version: Android 9.1.0
- Which debugger for React Native: Logcat