incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (Commented) (JIRA)" <>
Subject [jira] [Commented] (CB-461) Trying to insert bulk of data
Date Sun, 08 Apr 2012 17:56:17 GMT


Filip Maj commented on CB-461:

You are probably doing something like:

for (var i = 0, l = 1000; i < l; i++) {
    insertARow(); // calls into

Check this Stackoverflow thread out:

Looks like: if you are making greater than 512 calls into native code from JavaScript in a
*very* short amount of time, the JNI reference table doesn't have time to purge itself, and
you crash.


* use a larger transaction size to limit the number of INSERT calls being sent to Java
* use the accepted Answer in the SO post above to "reset" the functional scope in JavaScript
and force the reference table to purge itself. Essentially wrap your JS call to
in an anonymous function that executes itself immediately

Hope that helps.
> Trying to insert bulk of data
> -----------------------------
>                 Key: CB-461
>                 URL:
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.5.0
>         Environment: Android, Cordova, JQuery Mobile
>            Reporter: Jawwad Farooq
>            Assignee: Joe Bowser
>              Labels: Android, Plugin, Storage
> I tweaked class to use it for database related work instead of WebSQL for
Android. Everything is working fine unless I have requirement to insert more than 600 rows
in a go. When I tried to insert so many rows, around 500 rows were inserted successfully but
after that following error occurs:
> W/dalvikvm(16890): ReferenceTable overflow (max=512)
> W/dalvikvm(16890): Last 10 entries in JNI local reference table:
> W/dalvikvm(16890):   502: 0x44a9e110 cls=Ljava/lang/String; (28 bytes)
> W/dalvikvm(16890):   503: 0x44a9e908 cls=Ljava/lang/String; (28 bytes)
> W/dalvikvm(16890):   504: 0x44a9e908 cls=Ljava/lang/String; (28 bytes)
> W/dalvikvm(16890):   505: 0x44a9f358 cls=Ljava/lang/String; (28 bytes)
> W/dalvikvm(16890):   506: 0x44a9f358 cls=Ljava/lang/String; (28 bytes)
> W/dalvikvm(16890):   507: 0x44a9fca0 cls=Ljava/lang/String; (36 bytes)
> W/dalvikvm(16890):   508: 0x44a9fca0 cls=Ljava/lang/String; (36 bytes)
> W/dalvikvm(16890):   509: 0x44b94180 cls=Ljava/lang/String; (28 bytes)
> W/dalvikvm(16890):   510: 0x44b94180 cls=Ljava/lang/String; (28 bytes)
> W/dalvikvm(16890):   511: 0x449a6768
> cls=Lcom/nubinews/reader/Reader$RuntimeJSInterface; (12 bytes)
> W/dalvikvm(16890): JNI local reference table summary (512 entries):
> W/dalvikvm(16890):     1 of Ljava/lang/Class; 164B
> W/dalvikvm(16890):   507 of Ljava/lang/String; 28B (432 unique)
> W/dalvikvm(16890):     3 of Ljava/lang/String; 36B (2 unique)
> W/dalvikvm(16890):     1 of Lcom/nubinews/reader/Reader$RuntimeJSInterface; 12B
> W/dalvikvm(16890): Memory held directly by tracked refs is 12344 bytes
> E/dalvikvm(16890): Failed adding to JNI local ref table (has 512 entries)
> ..... and so on. Then I tried to figure out is this the problem of SQLiteDatabase class
or some Cordova related. So I commented out the actual database insertions in
But the problem persisted. 
> So, I came to a point that if you call a plugin for more than 512 times from a single
Javascript method, this exception will occur. Kindly look it in to this issue and let me know
as I am badly stuck at this point.
> Thanks for your time. 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message