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

immutable object causes rapid memory growth #281

Open
chenjf5 opened this issue Dec 8, 2022 · 1 comment
Open

immutable object causes rapid memory growth #281

chenjf5 opened this issue Dec 8, 2022 · 1 comment

Comments

@chenjf5
Copy link

chenjf5 commented Dec 8, 2022

nonMutatingArrayMethods adds many anonymous functions to each array, resulting in rapid memory growth. 2M data will increase to 50-80M.
function makeMethodReturnImmutable(obj, methodName) { var currentMethod = obj[methodName]; addPropertyTo(obj, methodName, function() { return Immutable(currentMethod.apply(obj, arguments)); }); }

function banProperty(target, methodName) { addPropertyTo(target, methodName, function() { throw new ImmutableError("The " + methodName + " method cannot be invoked on an Immutable data structure."); }); }

@crudh
Copy link
Collaborator

crudh commented Dec 8, 2022

@chenjf5 if you use the static syntax, https://github.com/rtfeldman/seamless-immutable#static-or-instance-syntax, it shouldn't do that.

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

No branches or pull requests

2 participants