What is JavaScript garbage collection? What's important for a web programmer to understand about JavaScript garbage collection, in order to write better code?...
I know that Javascript has a garbage collector. Therefor, using delete remove only a reference to the object, and when there is no more reference to this object, it is deleted by the GC.  Javascript is tricky, with the closures, the fuzzy name space...
How to get reference count for an object   Is it possible to determine if a javascript object has multiple references to it?  Or if it has references besides the one I'm accessing it with?  Or even just to get the reference count itself? Can I fi...
In Electron, I have my main process opening a BrowserWindow. The BrowserWindow loads one html page and then the same window eventually loads another html page.  main.js  var mainWindow; global.mainState = {   settings: {} } mainWindow = createWindow(...
I want to trigger JavaScript garbage collection. Is it possible? Why would I want to, or not want to, do this?...
I want to cache large objects in JS. These objects are retrieved by key, and it makes sense to cache them. But they won't fit in memory all at once, so I want them to be garbage collected if needed - the GC obviously knows better.  It is pretty t...
Following the first comment on this question:  What makes this function run much slower?  Does the garbage collector sweep stack memory? From what I've read, usually gc's don't do this. Following this question, I imagine that there is no...
Let's say I have a long running loop:  // Let's say this loop takes 10 seconds to execute for(let i = 0; i <= 1000000; ++i) {     const garbage = { i };     // some other code }   Can the garbage collector run during the loop, or it can on...
If I have something like this:  class MyComponent {    constructor() {      this.interval = Observbale.interval(1000);    } }  const c = new MyComponent(); const subscription = c.interval.subscribe(() => { ... })   Now let's say that at a cert...
I am trying to understand why the following code causes a memory leak     var aThing = null; var outer = function() {      console.log('running');     var something = aThing;      var closure1 = function() {         if (something) {...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.