Skip to content
This repository was archived by the owner on Sep 4, 2019. It is now read-only.
This repository was archived by the owner on Sep 4, 2019. It is now read-only.

(Feature request) PR 173889 - Memory leaks with reading file using blackberry.io.file.readFile() in WebWorks applications #67

@EricLeiLi

Description

@EricLeiLi

When a file is read successfully with blackberry.io.file.readFile(), a Blob is returned. This Blob is stored in AIR until a location change event is fired.
However, most WebWorks applications (e.g. bbUI.js or jQuery Mobile) are single page which dynamically load/unload DIVs. Thus, the location change event is NOT fired (e.g. window.location is always index.html) and hence those Blobs are never released in memory until the application closes.
In
https://github.com/blackberry/WebWorks-TabletOS/blob/master/framework/src/webworks/service/blob/BlobManager.as
: private function init(webkitControl:WebkitControl):void {
webkitControl.addEventListener(LocationChangeEvent.LOCATION_CHANGE, onPageChanged);
initRepository();
}
private function onPageChanged():void {

//Dump the old blob repository when we go to a new page to avoid memory leaks
initRepository(); } In above, you can see memory leak will occur until a
LocationChangeEvent.LOCATION_CHANGE Is dispatched. Is there a way to free a
Blob explicitly other than a LocationChangeEvent.LOCATION_CHANGE? Is there a
way to send this event other than changing the window.location for real?

Steps to Reproduce: In a simple 1-page WebWorks application, continue to use
blackberry.io.file.readFile() on the same file again and again. Even though
Javascript references to the Blob is made null, memory keeps increasing until
the application closes.

Expected Results: There should be a way other than a location change event to
free the memory used in Blobs.

Actual Results: Memory keeps increasing until the application closes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions