{"action":"created","issue":{"url":"https://api.github.com/repos/epoberezkin/ajv/issues/293","repository_url":"https://api.github.com/repos/epoberezkin/ajv","labels_url":"https://api.github.com/repos/epoberezkin/ajv/issues/293/labels{/name}","comments_url":"https://api.github.com/repos/epoberezkin/ajv/issues/293/comments","events_url":"https://api.github.com/repos/epoberezkin/ajv/issues/293/events","html_url":"https://github.com/epoberezkin/ajv/pull/293","id":174402644,"number":293,"title":"Add option to not retain validator source code","user":{"login":"rf","id":1093601,"avatar_url":"https://avatars.githubusercontent.com/u/1093601?v=3","gravatar_id":"","url":"https://api.github.com/users/rf","html_url":"https://github.com/rf","followers_url":"https://api.github.com/users/rf/followers","following_url":"https://api.github.com/users/rf/following{/other_user}","gists_url":"https://api.github.com/users/rf/gists{/gist_id}","starred_url":"https://api.github.com/users/rf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rf/subscriptions","organizations_url":"https://api.github.com/users/rf/orgs","repos_url":"https://api.github.com/users/rf/repos","events_url":"https://api.github.com/users/rf/events{/privacy}","received_events_url":"https://api.github.com/users/rf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-31T23:26:10Z","updated_at":"2016-09-01T00:36:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/epoberezkin/ajv/pulls/293","html_url":"https://github.com/epoberezkin/ajv/pull/293","diff_url":"https://github.com/epoberezkin/ajv/pull/293.diff","patch_url":"https://github.com/epoberezkin/ajv/pull/293.patch"},"body":"**What issue does this pull request resolve?**\r\nPrograms with many schemas eat a lot of memory in the form of validator source strings.\r\n\r\n**What changes did you make?**\r\nAdded an option to retain the `sourceCode` property and changed the `eval` to a `new Function` which is indirect and therefore does not retain references to the current context. This required explicitly passing in all variables that the compiled functions depend on. The option is called `retainSourceCode` and it defaults to true.\r\n\r\nThis has the added benefit of explicitly showing what variables are being used by the validator functions.\r\n\r\n@MadanThangavelu @Matt-Esch"},"comment":{"url":"https://api.github.com/repos/epoberezkin/ajv/issues/comments/243943227","html_url":"https://github.com/epoberezkin/ajv/pull/293#issuecomment-243943227","issue_url":"https://api.github.com/repos/epoberezkin/ajv/issues/293","id":243943227,"user":{"login":"rf","id":1093601,"avatar_url":"https://avatars.githubusercontent.com/u/1093601?v=3","gravatar_id":"","url":"https://api.github.com/users/rf","html_url":"https://github.com/rf","followers_url":"https://api.github.com/users/rf/followers","following_url":"https://api.github.com/users/rf/following{/other_user}","gists_url":"https://api.github.com/users/rf/gists{/gist_id}","starred_url":"https://api.github.com/users/rf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rf/subscriptions","organizations_url":"https://api.github.com/users/rf/orgs","repos_url":"https://api.github.com/users/rf/repos","events_url":"https://api.github.com/users/rf/events{/privacy}","received_events_url":"https://api.github.com/users/rf/received_events","type":"User","site_admin":false},"created_at":"2016-09-01T00:36:27Z","updated_at":"2016-09-01T00:36:27Z","body":"So it turns out that the strings will still be retained by the code object to support `.toString()` on the function.\r\n\r\nHowever, it may make sense to keep the `new Function()` change as it may make it easier to minify the generated javascript, which could potentially reduce the memory usage of the source strings. I'm going to investigate that tomorrow."}}
{"actor":{"display_login":"rf"}}