From 280223f3ef59570991aa5bfbe79a2b0c2b2f40ef Mon Sep 17 00:00:00 2001 From: Matthew Reishus Date: Mon, 12 Nov 2018 09:31:24 -0600 Subject: [PATCH] Fix memory leak when calling `.destroy` Creating a query builder, loading it with data, then destroying it was causing some memory to be retained in the browser. This should fix. This fix was created by my colleague w/ @claudior2184 . --- src/public.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/public.js b/src/public.js index 79491b96..ddd1b6a9 100644 --- a/src/public.js +++ b/src/public.js @@ -23,6 +23,16 @@ QueryBuilder.prototype.destroy = function() { .removeData('queryBuilder'); delete this.$el[0].queryBuilder; + + // clear properties to reduce memory footprint + this.filters = null; + this.settings = null; + this.plugins = null; + this.templates = null; + this.operators = null; + this.lang = null; + this.icons = null; + this.status = null; }; /**