Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8609289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:51:01+00:00 2026-06-12T03:51:01+00:00

I have a backbonejs app that works something like this: [Backbone MODEL] <—-> [Backbone

  • 0

I have a backbonejs app that works something like this:

[Backbone MODEL] <----> [Backbone VIEW] <----> [DOM ELEMENT]

The model and view are created and assigned to local variables within a function scope. If I remove the dom element (by calling jQuery().empty() on it’s parent element), will this delete all references to the View & subsequently the Model to avoid zombie objects/memory leaks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:51:02+00:00Added an answer on June 12, 2026 at 3:51 am

    As long as you are never assigning the model or view variables to anything that will stick around. Be wary of closures around the variables, don’t attach the variables as attributes of any other object, don’t attach the view or model to any events from any other objects. Then yes, this will clean itself up.

    But those are some pretty strict rules to abide by and don’t play well with most apps. You should be handling the removal of event handlers explicitly, and deleting any attribute on any object you had created.

    I have a few articles related to this (seems likely you’ve read at least one of them, already):

    The classic Zombies post: http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/

    an implementation of the zombie’s cleanup code, plus more, as an object on it’s own: http://lostechies.com/derickbailey/2011/12/12/composite-js-apps-regions-and-region-managers/

    Memory management in JavaScript and Backbone: http://lostechies.com/derickbailey/2012/03/19/backbone-js-and-javascript-garbage-collection/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Backbone model that looks like this: (function () { App.Company
I have a simple demo app like this Friend = Backbone.Model.extend name:null Friends =
We have a backbone.js app that displays a number of forms to the user.
I have a Rails 3.1 app that uses the codebrew/backbone-rails . In a .jst.ejs
I have a simple List-style Backbone app that I'm making with a Rails backend.
I have a Backbone view with a model. Additionally I have a global model
I have notifications in my Rails & Backbone.js app // MODEL NotificationModel = App.BB.Model.extend({
We have a Backbone.js app that supports file uploads using plupload. The uploads are
I have a Backbone collection jQuery -> class App.Collections.List extends Backbone.Collection model: App.Models.ListItem I
I have a web app that uses jPlayer as the backbone of a playlist

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.