No memory and NullPointer exceptions in library
First, thank you to NeoTechni, mlc, Erel, and XverhelstX for laying the foundation to and creating the Technis library. :sign0098: I ended up using it because the database approach I developed was far too resource intensive (often causing my app to crash).
I use the Technis library to identify the names associated with SMS as my app reads in the messages from the SMS log (SMSMessages). For some users, the log may contain hundreds or thousands of messages, and the app loops through the messages one at a time. In each cycle of the loop, the app calls GetContactByPhone from the Technis library. When there are few messages in SMSMessages (such as fewer than 100), no problems occur. However when there are several hundred or more messages in SMSMessages, the No memory and NullPointer exceptions occur, after 150 or more messages have been processed successfully.
Here's the key part of the code:
Dim contactnames As Technis
.
.
.
'looping through individual messages in SMSMessages
'address = a cleaned version of the address (phone number) for a particular text message
Try
textname=contactnames.GetContactByPhone(address)
Catch
Log(LastException.Message)
End Try
Here is the trace output for the exceptions logged when this problem occurs:
binder=0x7b49f8 transaction failed fd=-2147483647, size=0, err=-2147483646
(Unknown error: 2147483646)
cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
cannot map BpMemoryHeap (binder=0x7b49f8), size=0, fd=-1 (Bad file number)
*** Uncaught remote exception! (Exceptions are not yet supported across
processes.)
java.lang.RuntimeException: No memory in memObj
at android.database.CursorWindow.native_init(Native Method)
at android.database.CursorWindow.<init>(CursorWindow.java:550)
at android.database.CursorWindow.<init>(CursorWindow.java:29)
at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:525)
at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:523)
at
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:103)
at android.os.Binder.execTransact(Binder.java:320)
at dalvik.system.NativeStart.run(Native Method)
java.lang.NullPointerException
The content of the log output is the same for each separate time the exceptions occur, but only the binder value changes.
I don't know how to interpret this output. What is the source of the problem? And how can I avoid these errors?
Thank you for any advice you might have!