I've been using javascript module pattern for while.
I showed an example of a module pattern to one of my coworkers. He said that the following code can make a memory leak.
var test = (function(){
var events = {
// my functions go here
}
return {
// return something
}
}());
he said that since events variable is an object and i'm not setting null for it, it can cause a memory leak even if I set null for test later.
As far as I know, the above code snippet is okay because I'm not passing events around.
I need advices!