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 6942857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:04:47+00:00 2026-05-27T13:04:47+00:00

So I know how to delete one variable… variable = null; or delete variable;

  • 0

So I know how to delete one variable… variable = null; or delete variable; but say I have lots of different variables that all point to the same value but I can only access a few of those variables, how can I clear that value of memory.

So how bout an example… I have:

var a = {value:5};    //create the reference everything points to
var b = a;
var c = a;

CallFunctionThatKeepsReference(a);
//var x = a;          //x in this function but I can't directly access x.

a = null; b = null; c = null;    //the object still exists in x.
delete a; delete b; delete c;    //the object still exists in x.

//What can I do to accomplish this effect...
Nuke(a);  //or b, or c
//a,b,c,x now all point to null.

I can’t access x because it is kept in a function that I call. This is because it is a giant closure and runs async setTimeout code so it never uncloses.

  • 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-05-27T13:04:48+00:00Added an answer on May 27, 2026 at 1:04 pm

    I’d strongly recommend another approach at this. JavaScript isn’t C, so you don’t need to absolutely and explicitly reclaim all of your own memory. Instead, write your code so that it works well with the garbage collector. Specifically, ensure that your variables are declared within functions / closures, at the lowest-level possible for what you need to accomplish. Once the function finishes, any variables and memory will automatically be recycled.

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

Sidebar

Related Questions

I know that new-ing something in one module and delete-ing it in another can
I only know of one way: Right click and click 'delete me' How else
The problem I'm running into is that as far as I know the delete
i know how to delete records for jqgrid, but i realise i cannot select
Does anyone know how to delete an object and all of it's related entities.
I know you can override delete and save methods in DJango models, but can
I know that I am supposed to use delete [] after I use new
I'm currently trying to write a small service to delete one directory and all
Okay, so let's say I have a mysql database table with two columns, one
So pretty straight forward but I cant find the answer. Say I have an

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.