Reputation: 722
I have created a image tag in javascript for some processing, after that when i complete the processing i need to remove/dispose the object. i use the jquery remove method to remove the object. what is the difference of jquery remove method and assigning null to the object? which should i use.?
function processInfo()
{
var img = new Image();
/*
some processing.
*/
// at this line i need to remove/dispose the object.
$(img).remove();
}
Upvotes: 1
Views: 1461
Reputation: 3247
jQuery remove
removes element reference from DOM. If your javascript reference is scoped to processInfo
function you don't need to do anything else, garbage collector will remove this ref automatically. Even more, if you don't add your img
to DOM remove
call also not necessary.
Upvotes: 1