[TIMOB-19861] Alloy Collection - Dealing two or more collections at the same time causes memory leak
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Shawn Lan |
Assignee | Unknown |
Created | 2015-08-28T19:26:52.000+0000 |
Updated | 2018-02-28T19:55:45.000+0000 |
Description
Create a default Alloy project with the following:
index.js
Alloy.createCollection("samplea").fetch();
Alloy.createCollection("sampleb").fetch();
$.index.open();
index.xml
<Alloy>
<Window />
</Alloy>
models/samplea.js
exports.definition = {
config: {
"columns": {
"id":"INTEGER"
},
"adapter": {
"type": "sql",
"collection_name": "sampleas",
"idAttribute":"id"
}
},
extendModel : function(Model) {
_.extend(Model.prototype, {
});
return Model;
},
extendCollection : function(Collection) {
_.extend(Collection.prototype, {
});
return Collection;
}
};
models/sampleb.js
exports.definition = {
config: {
"columns": {
"id":"INTEGER"
},
"adapter": {
"type": "sql",
"collection_name": "samplebs",
"idAttribute":"id"
}
},
extendModel : function(Model) {
_.extend(Model.prototype, {
});
return Model;
},
extendCollection : function(Collection) {
_.extend(Collection.prototype, {
});
return Collection;
}
};
Using xCode instrument "Leaks" to monitor the app. Soon after launching the app, there appear several leaked objects.
I've done more testings. It doesn't need to be two different collections. The following produces the same result:
However, if the second fetch() is run long after the first fetch(), there is no leaked object:
Hello, This is still a bug in the latest releases. I tested with Studio 4.3.3.201510212245. Ti SDK 5.0.2.GA and iOS 9.1. The memory leak occurs. I also tried [~shawnlan] test with two similar collections. The result still the same. Thanks.