ngageoint / geopackage-js

GeoPackage JavaScript Library
http://ngageoint.github.io/geopackage-js/
MIT License
304 stars 78 forks source link

Running out of reserved function pointers #175

Open brenmous opened 2 years ago

brenmous commented 2 years ago

I'm using leaflet-geopackage in the browser (via https://unpkg.com/@ngageoint/leaflet-geopackage/dist/leaflet-geopackage.js).

I have a service that generates new data as a geopackage, and browser code that consumes and displays it with leaflet-geopackage. When new data arrives I refresh the map by creating a new geoPackageFeatureLayer and removing the old one from the map. After enough cycles, I get the error Uncaught (in promise) Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.

The culprits are SqliteAdapter.prototype.registerFunction/SqljsAdapter.prototype.registerFunction, eventually throwing here function va(a){for(var b=0;64>b;b++)if(!t[b])return t[b]=a,ra+b;throw"Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.";} in the emscripten code.

I'm a novice with JS, so my workaround so far is to refresh the page entirely to update the data. I'm not sure if this is something that can be fixed on the geopackage-js end, or is upstream with the SQL libraries. If you have any advice about how to get around this, or if it can be fixed, that would be much appreciated.