Opened 13 years ago
Closed 13 years ago
#538 closed defect/bug (fixed)
Navit runs out of global refs on Android
Reported by: | me.yahoo.com/a/hthlykcvonrgunec9ub0cbz2zzjwdg10#c2fd6 | Owned by: | cp15 |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | port/android | Version: | git master |
Severity: | Keywords: | android, crash, referencetable overflow, patch | |
Cc: | edwintorok@… |
Description
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 android.graphics.Paint objects, and android.graphics.Bitmap 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)
Change History (5)
Changed 13 years ago by me.yahoo.com/a/hthlykcvonrgunec9ub0cbz2zzjwdg10#c2fd6
Changed 13 years ago by me.yahoo.com/a/hthlykcvonrgunec9ub0cbz2zzjwdg10#c2fd6
comment:1 Changed 13 years ago by me.yahoo.com/a/hthlykcvonrgunec9ub0cbz2zzjwdg10#c2fd6
Here is .apk with these patches applied, if you want to test the effects: http://www.fileden.com/files/2009/9/1/2561232/Navit.apk
comment:2 Changed 13 years ago by me.yahoo.com/a/hthlykcvonrgunec9ub0cbz2zzjwdg10#c2fd6
- 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!
Cumulative patch (including the fix for ticker #522)