Bug 693546 - Bitmaps are not recycled in Android, leading to OutOfMemory errors
Summary: Bitmaps are not recycled in Android, leading to OutOfMemory errors
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: master
Hardware: Android Phone Android
: P4 major
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-10 19:03 UTC by André Ferreira
Modified: 2016-03-28 14:41 UTC (History)
4 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Source patch (984 bytes, application/octet-stream)
2013-01-10 19:03 UTC, André Ferreira
Details

Note You need to log in before you can comment on or make changes to this bug.
Description André Ferreira 2013-01-10 19:03:46 UTC
Created attachment 9204 [details]
Source patch

Observable by zooming in and out of a PDF repeatedly.

The library will allocate bitmaps for each zoom operation which will not be released by the system as there is no explicit call to Bitmap.recycle().

This patch resolves the issue.
Comment 1 Robin Watts 2013-01-11 15:43:33 UTC
Fixed in:

commit f30db116a89652de0da03e27513753f0e432fd1a
Author: Robin Watts <robin.watts@artifex.com>
Date:   Thu Jan 10 20:19:20 2013 +0000

    Bug 693546: Improve Bitmap recycling in Android app.

    Thanks to Andre Ferreira for bringing this up and submitting a
    patch. (Andre should have &eacute, but this upsets git/my editor, sorry!)

    Change BitmapHolder handling so that we explicitly recycle bitmaps.
    Old versions of Android need this to avoid bitmaps 'sticking' in
    memory, and it doesn't hurt on new versions.

    Also, explicitly empty the bitmap holder before creating a new
    bitmap. This avoids us holding more than one copy of the (potentially
    large) bitmaps.

Many thanks!