Open EricLeiLi opened 12 years ago
It's new feature requirement. By design, there was no requirement to free the memory because blob objects (which map to these AIR memory) should always be available if page transition doesn't happen. Will create GitHub issue.
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.