5

I have Java & Native components in my android project. Native is required as it is legacy code and my organization don't want to waste resources in re-writing whole code again. In the native code I need to post some event to the java layer, so I am using "AttachCurrentThread()" and "DetachCurrentThread()" functions for achieving the same. Made an API to avoid the repetition of the code. Same function was working fine and after few calls, crashing with the below error.

F art     : art/runtime/indirect_reference_table.cc:77] Check failed: table_mem_map_.get() != nullptr ashmem_create_region failed for 'indirect ref table': Too many open files

Tried googling this error but in-vain. Can anyone guide me in resolving this error. Guidance is also greatly appreciated.

Thanks.

Suman
  • 4,221
  • 7
  • 44
  • 64
  • 1
    "Too many open files" sounds like you have a memory leak. Not detaching attached threads causes memory leaks. – Titus Jan 13 '16 at 12:31
  • 3
    Or possibly a file descriptor leak. Try `adb shell ls -l /proc//fd` on the app process to see how many files are open. Let it run for a bit, then run the command again and see if the number of open files is steadily increasing. Often the filename shown by `-l` will give an indication as to what has opened the file descriptor. – fadden Jan 13 '16 at 16:40
  • 1
    Thanks guys, as @fadden suggested, it was a descriptor leak. Fixed it. – Suman Feb 19 '16 at 06:06

0 Answers0