Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Fixed potential memory leaks #105

Merged
merged 1 commit into from
Apr 13, 2016

Conversation

saskodh
Copy link
Contributor

@saskodh saskodh commented Apr 13, 2016

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.

- registered listeners on $rootScope should always be unregistered on destroy
- valdrFormGroupCtrl#removeMessageElement was retaining the reference to the element after it's removal [minor-leak]
@coveralls
Copy link

Coverage Status

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

@marcelstoer marcelstoer merged commit ec235ce into netceteragroup:master Apr 13, 2016
@marcelstoer
Copy link
Collaborator

Thanks!

@saskodh
Copy link
Contributor Author

saskodh commented Apr 13, 2016

No problem :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants