You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Local reference table overflow while adding markers in bulk #2726
@tobrun You need to call DeleteLocalRef on any objects that are created in a loop in the JNI.
JNI only deletes "local refs" (ie Objects) at the exit of a JNI method, so if you generate a lot of objects before you return, you can overflow the local ref table.
If we could solve the 30fps issue in Android then we could punt renderSync onto a separate Java thread and not freeze the rest of the app's UI while the map does it's thing. However this presents user location dot sync issues that I have not figure out yet.
Activity
ljbade commentedon Oct 22, 2015
@tobrun You need to call
DeleteLocalRefon any objects that are created in a loop in the JNI.JNI only deletes "local refs" (ie Objects) at the exit of a JNI method, so if you generate a lot of objects before you return, you can overflow the local ref table.
ljbade commentedon Oct 22, 2015
In this case from the log, it is
StringandLatLngobjects.ljbade commentedon Oct 23, 2015
Deleting
jidfixed the overflow.1,000 markers works:

10,000 markers freezes after it gets this far:

ljbade commentedon Oct 23, 2015
Making a PR now.
Still leaves:
[android] Fix JNI local ref overflow
ljbade commentedon Oct 23, 2015
@tobrun Can we also add an option to switch between
addMarker()one at a time, andaddMarkers()to stress test both ways.ljbade commentedon Oct 23, 2015
Been investigating the 10,000 stall.
I can repro with just 2,000 markers.
Loading the GeoJSON into
MarkerOptionlist takes 1.3 seconds.Adding the markers to the map with
addMarkerstakes 0.3 seconds.This happens in a async task so doesn't freeze the Android UI.
What happens next is that the Core GL threads process the markers, and stalls
renderSync, which in turn freezes the map.@kkaefer Is this a known problem in CoreGL?
If we could solve the 30fps issue in Android then we could punt
renderSynconto a separate Java thread and not freeze the rest of the app's UI while the map does it's thing. However this presents user location dot sync issues that I have not figure out yet.ljbade commentedon Oct 23, 2015
@kkaefer by the way it only uses 1/8th of the CPU cores
ljbade commentedon Oct 23, 2015
Testing with 10k markers:
Loading the GeoJSON into
MarkerOptionlist takes 1.3 seconds.Adding the markers to the map with
addMarkerstakes 0.7 seconds.ljbade commentedon Oct 23, 2015
Testing with the maximum in the GeoJSON (27,267 markers):
Loading the GeoJSON into
MarkerOptionlist takes 2.0 seconds.Adding the markers to the map with
addMarkerstakes 2.5 seconds.6 remaining items
ljbade commentedon Oct 23, 2015
Ha-ha hmm
[android] Fix JNI local ref overflow
[android] Test max 27.4k markers
[android] mapbox#2726 - moved utility classes to separate package
[android] mapbox#2726 - finalise BulkAddMarkers activity