java - Bizarre ArrayIndexOutOfBoundsException -
java - Bizarre ArrayIndexOutOfBoundsException -
this question has reply here:
how avoid java.lang.arrayindexoutofboundsexception? [duplicate] 2 answersi'm writing android application, , in there's array scan through in few places. reason, crashes in 1 of these places arrayindexoutofboundsexception. when debug it, indices @ times of crashes reasonable , within bounds of array (although different indices every time). more annoyingly, can't @ contents of array, because every time scroll through variables debugger disconnects right before array. set array array create in c function , homecoming (using android ndk et cetera) , best guess array messed up, works fine more not, , when crash doesn't crash on index 0 whatever i'm getting c code must in cases still work plenty read some. potentially relevant info if stop app when hasn't crashed debugger has no problem looking @ array.
whenever things unusual (like when i
, j
int
's , after j = * i
j
has value of 35), multi-threading problem. (i've seen similar problems cpu doing operations out-of-order. no multiple threads, there might be.) array reference local variable , work that. other threads can alter values in array, cannot alter length.
then might want have @ threads have running, doing, , doing maintain them shredding data.
also: debugger may not stop threads when hits exception. (there's alternative somewhere.) guilty thread can remove evidence , escape on border time @ things.
java android arrays android-ndk bounds
Comments
Post a Comment