netceteragroup / valdr

A model centric approach to AngularJS form validation
http://netceteragroup.github.io/valdr/
MIT License
153 stars 43 forks source link

Fixed potential memory leaks #105

Closed saskodh closed 8 years ago

saskodh commented 8 years ago

Description

1. valdrMessage-directive [major]

Cause: the directive registers event listener on the $rootScope which it is not unregistered when the directive is destroyed. Consequence: The $rootScope retains reference to the directive scope and element through the event handler's function closure. The scope and the element have references to their parent and children, which means that large piece of $scope and DOM objects will remain in memory after their use because they are not eligible for garbage collection. This causes major memory leaks due to the fact that the $rootScope is singleton service and will be alive though out the whole application operation time.

2. valdrFormGroup-directive [minor]

Cause: valdrFormGroup controller retains reference to the valdrMessage elements for the former valdrFormItems. Consequence: former valdrMessage elements cannot be garbage collected after their removal from the DOM. However this is not a major memory leak because it is temporary i.e. while the valdrFormGroup directive instance is alive.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 9c0963b2b81098a8f864d3bbde8c07dcc07c4bbf on saskodh:valdrMessage-memleak into 05e58721d61110ac161992303899189821f96f22 on netceteragroup:master.

marcelstoer commented 8 years ago

Thanks!

saskodh commented 8 years ago

No problem :)