[ALOY-915] Alloy Collection (RESTful) is not releasing memory properly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-01-03T17:17:55.000+0000 |
Affected Version/s | Alloy 1.3.0 |
Fix Version/s | n/a |
Components | Runtime |
Labels | supportTeam |
Reporter | Eduardo Gomez |
Assignee | Tony Lukasavage |
Created | 2014-01-03T16:45:59.000+0000 |
Updated | 2014-06-22T13:23:20.000+0000 |
Description
Issue description
Alloy Collection is not releasing memory properly if fetch is run WITH a callback.Steps to reproduce
Ti project files here: https://www.dropbox.com/sh/f4h0fkyp08numrm/W9rvtLZ1Rr - To run the app WITH a memory leak: 1) In the ledgerlists.fetch({.... ; lines 15-18 of test1.js ; UNCOMMENT these lines and build the app. To be clear, the lines to un-comment are: {quote} success: function(collection, response){ console.log("fetch finished"); console.log(response); } {quote} 2) Run Instruments {quote} select "Allocations" icon, click "Choose" pick the drop down box "Choose Target" select "Attach to Process" -> scroll down to the "System" heading area, then underneath that, find the app (leakTest1) click on Record (top left); enter uid/pwd if needed on mac osx in the top right corner of Instruments window, put "TiUI" to the filter boxThoughts
We tried out to unbind the Collection using reset method after the Controller Window closed: E.I. http://stackoverflow.com/questions/9202599/how-do-i-unbind-a-backbone-collection-fetch-callback Since "Using reset with no arguments is useful as a way to empty the collection." http://docs.appcelerator.com/backbone/0.9.2/#Collection-reset We are seeing the Ti objects getting released after the 3rd or 4th time (Under #transient column) Screen shoot: AlloyMemoryLeak_Instruments.jpg Quoted the code lines that were added on our side for testing purposes (controllers/test1.js): {quote} $.closeButton.addEventListener('click', function(e) { $.win1.close(); $.win1.removeAllChildren(); $.destroy(); ledgerlists.reset(); }); {quote} We also attempted to use the Alloy.Collections.instance method with the name of the model file minus the extension as the only parameter to create or access the singleton. However this ended up just getting released the TiWindow Screen shoot: AlloyCollection_SingletonInstance.jpg For example (controllers/test1.js): {quote} // some restful endpoint - testing purposes only //var ledgerlists = Alloy.createCollection('ledgerlist'); var ledgerlists = Alloy.Collections.instance('ledgerlist'); {quote}Attachments
File | Date | Size |
---|---|---|
AlloyCollection_FetchMethod.jpg | 2014-01-03T16:58:55.000+0000 | 321048 |
AlloyCollection_SingletonInstance.jpg | 2014-01-03T16:45:59.000+0000 | 332387 |
AlloyMemoryLeak_Instruments.jpg | 2014-01-03T16:45:59.000+0000 | 312267 |
leakTest1.zip | 2014-01-03T17:00:53.000+0000 | 9461788 |