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

Quasi memory leak in Gridstack._prepareElementByNode #505

Closed
DavidKDeutsch opened this issue Aug 16, 2016 · 1 comment
Closed

Quasi memory leak in Gridstack._prepareElementByNode #505

DavidKDeutsch opened this issue Aug 16, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@DavidKDeutsch
Copy link

Gridstack._prepareElementByNode uses _.extend to set the draggable options and whatnot on an added widget, e.g.:

 el
            .draggable(_.extend(this.opts.draggable, {
                containment: this.opts.isNested ? this.container.parent() : null,
                start: onStartMoving,
                stop: onEndMoving,
                drag: dragOrResize
            }))

This has the effect of modifying this.opts.draggable, setting its members to the same methods that are passed to el.draggable(). Since these new methods reference el, the widget stays in memory even after it is removed. Probably not a huge deal, as only one widget can leak at a time (as this.opts will get overwritten with the new widget's options), but it can make for a frustrating search for a leak.

radiolips added a commit to radiolips/gridstack.js that referenced this issue Aug 17, 2016
@radiolips radiolips mentioned this issue Aug 17, 2016
@radiolips radiolips added this to the v0.2.7 milestone Aug 17, 2016
@radiolips
Copy link
Member

@DavidKDeutsch Wow. That was an amazing catch. I don't believe this.opts was intended to be mutated when making those _.extend calls.

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

No branches or pull requests

3 participants