Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoiding closure leaks #176

Merged
merged 1 commit into from May 25, 2016
Merged

Avoiding closure leaks #176

merged 1 commit into from May 25, 2016

Conversation

andrija-hers
Copy link
Contributor

The proposed PR gets rid of memory leaks that are introduced via "closure leaks".
The main problem was within the validateSchema method of the Validator class.
Three closures were produced there: shouldResolve, resolve, and an <anonymous> one.
These three were mutually dependent. However, shouldResolve depends on no outer params, so it was taken out of the validateSchema and promoted to a standalone function.
resolve became the superResolve method, and the <anonymous> one became the schemaTraverser method of the Validator class.

In the same manner, the code in helpers.js was cleared. Affected are:

  • deepMerge
  • importErrors method of the ValidatorResult class
  • toString method of the ValidatorResult class
  • encodePath method of the ValidatorResult class

@tdegrunt tdegrunt merged commit f9e609a into tdegrunt:master May 25, 2016
@tdegrunt
Copy link
Owner

Thank you!

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

Successfully merging this pull request may close these issues.

None yet

2 participants