Opened 13 years ago

Closed 13 years ago

#538 closed defect/bug (fixed)

Navit runs out of global refs on Android

Reported by: Owned by: cp15
Priority: major Milestone:
Component: port/android Version: git master
Severity: Keywords: android, crash, referencetable overflow, patch
Cc: edwintorok@…


On my HTC Hero navit is killed after a few minutes of navigating, due tu a ReferenceTable? overflow error. The logcat trace shows lots of objects, and objects. Apparently everytime I pan the map it creates new objects, and the old ones never get freed.

Android only has a max of 512000 globalrefs for an app (2000 on the emulator), so creating a new paint object for each element on the map won't work.

The attached patch fixes this by:

  • moving the Paint object from graphics_gc_priv to graphics_priv, graphics_gc_priv will only store the state, and we can use a single Paint object per graphics_priv
  • image_destroy is never called for a bitmap, but image_free is, so move the code there, so the images get freed too

Before the patch as soon as navit tried to load a map, it got killed (on the emulator), or get killed a few minutes after (when I navigated the map). After the patch, I can navigate the map (pan) without any crashes!

Attachments (2)

android_navit_memory.patch (6.7 KB) - added by 13 years ago.
android_fix.patch (8.1 KB) - added by 13 years ago.
Cumulative patch (including the fix for ticker #522)

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by

Changed 13 years ago by

Cumulative patch (including the fix for ticker #522)

comment:1 Changed 13 years ago by

Here is .apk with these patches applied, if you want to test the effects:

comment:2 Changed 13 years ago by

  • Cc edwintorok@… added

comment:3 Changed 13 years ago by kazer

  • Resolution set to fixed
  • Status changed from new to closed

android_navit_memory.patch applied in rev2932, android_fix.patch applied in rev2933. Thank you!

Note: See TracTickets for help on using tickets.