I\'m calling a function 50 times a second, which does some expensive things as it is painting alot on a element.
It works great, no problems
Look at heap profile under the Profiles tab in Chrome's developer tools for information about memory usage.
You can do the following to prevent memory leaks:
var
keyword to give your variables function scope, so they can be garbage collected when they go out of scope. Without the var
keyword variables have global scope.delete variable;
statements to remove the object as well as the reference from memory. Setting the variable to null will only remove the object from memory, but not its reference.