ImageSource Memory Management for Android Bitmap Reclamation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In resource-constrained devices, such as Android-based applications, image memory allocated from unmanaged memory is not frequently reclaimed by the garbage collector, leading to memory exhaustion and application restarts, as bitmap objects holding onto large image memory blocks are not promptly freed.

Innovation Solution

Implementing an ImageSource class that manages image memory by using a binding object to an ImageView, with lifecycle methods for creation, destruction, binding, and unbinding, and employing weak references to enable the garbage collector to reclaim unmanaged memory when images are no longer visible, ensuring that image memory is visible to the heap manager and can be quickly freed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If image memory is allocated from unmanaged memory, then the garbage collector cannot reclaim the memory, but this leads to memory exhaustion and application restarts

Engineering Contradiction:
Improvememory stabilityVSAvoidavailable memory
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The patent segments memory management into two distinct portions: managed memory for control structures (ImageSource, binding objects, ImageView references) and unmanaged memory for actual image data storage. This segmentation allows the garbage collector to manage the control structures and detect when they are no longer needed, while the unmanaged memory can be efficiently allocated and freed based on garbage collection events, resolving the contradiction between memory stability and available memory.

Inventive Principle:
Principle #1Segmentation

2Reliability

If bitmap objects hold onto large image memory blocks, then memory is retained for potential reuse, but this prevents timely memory reclamation and causes memory exhaustion

Engineering Contradiction:
Improvememory availabilityVSAvoidmemory reclamation time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent implements a feedback mechanism where the binding object monitors the visibility state of images through lifecycle methods. When an image is no longer visible (unbind called), the binding object notifies the ImageSource, which then triggers garbage collection. This feedback loop ensures that memory is reclaimed promptly when no longer needed, resolving the contradiction between maintaining memory availability and enabling timely reclamation.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The ImageSource and binding objects automatically manage their own memory lifecycle without requiring external intervention. The binding object detects when it is no longer bound to an ImageView and automatically initiates the memory reclamation process by allowing the ImageSource to be garbage collected, which in turn frees the unmanaged memory. This self-service approach eliminates delays associated with manual memory management.

Inventive Principle:
Principle #25Self-service

3Ease of operation

If a dynamic view architecture with garbage collection is used, then memory can be automatically managed, but this increases system complexity

Engineering Contradiction:
Improvememory management automationVSAvoidsystem architecture complexity
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The patent introduces a binding object as an intermediary between the ImageSource (managed memory) and the unmanaged image data. This binding object serves as a mediator that manages the relationship and lifecycle coordination between managed and unmanaged portions. By inserting this intermediary layer, the system achieves automated memory management through garbage collection while maintaining a clear separation of concerns, thus managing complexity rather than simply increasing it.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS8516018B1Budgeting native resources in resource-constrained devices that employ a dynamic, garbage-collection based view architecture
Publication Date: 2013.08.20 GOOGLE LLC
  • US8516018B1 patent drawing
  • US8516018B1 patent drawing
  • US8516018B1 patent drawing

AI summary

Disclosed are apparatus and methods for managing image storage. An image source of a computing device can include one or more functions and a reference to image views for an image object, such as a bitmap object. The image object can include a reference to first storage that stores an image. The image source, the reference to the image views, and the image object are stored in a managed portion of memory. The first storage is stored in an unmanaged portion of memory differing from the managed portion. The computing device displays the image. Upon determining to discontinue displaying the image, an unbind function of the image source is called. The image source responsively discontinues display of the image. The image source receives an indication that the image views are solely weakly referenced. In response to the indication, the image source deallocates the first storage.