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

Remove data when an element is removed #870

Open
krampstudio opened this issue Jun 3, 2014 · 7 comments
Open

Remove data when an element is removed #870

krampstudio opened this issue Jun 3, 2014 · 7 comments

Comments

@krampstudio
Copy link

As a user I'd expect that when an element is removed the .data() linked to this element are also removed (or at least flushed when Paper.clear() is called).
Nevertheless, if I create another element with the same id, I'm getting the data of the previous element (due to the way it is stored inside the variable eldata)

May be removeData could be called inside elproto.remove

@tomasAlabes
Copy link
Collaborator

Now ids are random, so at least you shouldn't have that problem.

@jvilk
Copy link

jvilk commented Feb 17, 2017

Note that this bug causes a memory leak, as the eldata variable grows without bound as new data is added without being removed.

@davidjmcclelland
Copy link

davidjmcclelland commented Apr 6, 2017

I am seeing an issue that tracks with what @jvilk is describing, specific to IE9-Edge where memory is not released because objects are retaining references to data. Other browsers do not seem affected. Would love to fix this if it doesn't require a ton of changes.

@jvilk
Copy link

jvilk commented Apr 6, 2017

@davidjmcclelland I have a fix open in a PR here: #1077

It's a one line fix that's easy to apply.

@davidjmcclelland
Copy link

davidjmcclelland commented Apr 7, 2017 via email

@jvilk
Copy link

jvilk commented Apr 7, 2017

@davidjmcclelland is this code open source, by any chance? (I'm not promising anything, but I've been on a bit of a JS memory leak bent.)

And is this browser specific? That sounds odd.

@davidjmcclelland
Copy link

davidjmcclelland commented Apr 7, 2017 via email

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

No branches or pull requests

4 participants