Skip to content

Memory leak with multiple calls #1

Closed
@dwachss

Description

@dwachss

Hi Danny,
We are using your parsecss. It works great. But there was a memory leak. After calling it around 100 times chrome browser crashes. We looked at the code and observed that global varible munged is increasing the heap memory (700MB) and this causes the chrome browser to crash.
We have reset this varible to empty dictionary in function as follows

$.parsecss = function(e, t) {
var n = {};
e = munge(e).replace(/@(([^;`]|`[^b]|`b[^%])*(`b%)?);?/g, function(e, n) {
processAtRule($.trim(n), t);
return ""
});
$.each(e.split("`b%"), function(e, t) {
t = t.split("%b`");
if (t.length < 2) return;
t[0] = restore(t[0]);
n[t[0]] = $.extend(n[t[0]] || {}, parsedeclarations(t[1]))
});
t(n)
munged = {};
};

It works good now. Let me know if it is OK to reset it.

--Raghavendra Chary

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions