Am I creating a memory leak?
- function Widget(){
- this.myfield = $('#id_myfield');
- var clickHandler = function(event){ //do something };
- this.myfield.bind('click', clickHandler);
- }
- myWdgt = new Widget();
I have made it a habit to try to only query the DOM once for performance reasons. Now I'm not sure if I'm creating a memory leak by doing so.
Should I be utilizing the window.unload event to explicitly delete my object instances?
Thanks
Josh