Skip to content

Instantly share code, notes, and snippets.

@vinothbabu
Created October 16, 2012 09:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinothbabu/3898340 to your computer and use it in GitHub Desktop.
Save vinothbabu/3898340 to your computer and use it in GitHub Desktop.
Memory Cleaning for Application developed using Appcelerator Titanium
var MemoryClean = function() {
var _window;
/*
Here we make our "auto-release" pool. It's simply a window.
We hide it upon creation so it won't interfere with our view hierarchy.
5/3/2011: It seems that the window does not need to be a subcontext, just a regular window will do.
*/
this.init = function() {
//_window = Ti.UI.createWindow();
_window = {};
//_window.hide();
//_window.open();
}
// This is where we clear out the memPool by closing it then reopening it again.
this.clean = function(obj) {
//_window.add(obj);
_window.view = obj;
Ti.API.warn("This is our Memory" +Ti.Platform.availableMemory);
Ti.API.warn('Cleaning MemoryPool.');
// We empty the pool by closing it.
//_window.close();
_window = null;
// We recreate the window again for the next object
this.init();
};
this.init();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment