Memory leak in jQuery UI Draggable with MeteorJS?
For anyone suffering from this issue I've designed a temporary fix(this runs for every template re-render).
(function () {
var oldRender = Spark.renderToRange;
Spark.renderToRange = function (range, htmlFunc) {
var oldFunc = htmlFunc;
htmlFunc = function () {
// put in clean up code here Example:
if(range._start === $('#myTemplate')[0]) {
$('#myTemplate').find('.ui-draggable').draggable('destroy');
}
// end clean up code
return oldFunc.apply(this, arguments);
};
return oldRender.apply(this, arguments);
};
})();
One of the Meteor Core developers on the Google Groups forum informed me(link) that they are re-writing the templating package and this will address this issue.
How do i release allocated memory for array?
You don't want to use a weak reference. If you do that your array will get released immediately.
weak var weakArray: [[String:Any]]? = []
Will contain nil as soon as you create it.
Instead, you should set the array to nil (or empty) once you're done with the contents:
You could use `menuDetails.removeAll() to delete all the entries in the array, or you could change your declaration to make it an Optional
var menuDetails:[[String:Any]]? = []//this my global array object
And then set it to nil when you're done with it:
menuDetails = nil
How do i release allocated memory for array?
You don't want to use a weak reference. If you do that your array will get released immediately.
weak var weakArray: [[String:Any]]? = []
Will contain nil as soon as you create it.
Instead, you should set the array to nil (or empty) once you're done with the contents:
You could use `menuDetails.removeAll() to delete all the entries in the array, or you could change your declaration to make it an Optional
var menuDetails:[[String:Any]]? = []//this my global array object
And then set it to nil when you're done with it:
menuDetails = nil
Related Topics
How to Make One Side of a Div Pointy with CSS
Uitextview - Can't Set Underline or Strikethrough Attributes on Text
Xcode6 Goldmaster Submitting Build Failed with Error
Box Shadow Spread Bug in Webkit in iOS 7 on Retina Ipads
Swift Playground and Simulator Error (Ipc/Mig) Server Died, Unable to Boot The iOS Simulator
Display: Flex; Doesn't Work on iPad (Both Chrome and Safari)
Best Approach to Change Xib Direction Programmatically
How to Change Select Box Background Without Losing The Right Arrow on Mobile Safari
How to Get Path to a Subfolder in Main Bundle
How to Keep Animated Gifs Animated While Scrolling on iOS Devices
Add Udid in Current Provisioning Profile
How to Set Gradient Background Transparency on iOS Safari
Cannot Pass Immutable Value as Inout Argument: Literals Are Not Mutable, Why
Mobile Safari: Inertia Scrolling on Body and Minimal UI Behavior
Why Wkwebview Doesn't Display Videos? - Swift 3
Stop Overscroll When Using "-Webkit-Overflow-Scrolling: Touch"
iOS Facebook Sdk Error Domain Com.Facebook.Sdk Code 2 and Code 7