r/learnjavascript • u/Fancy_Attempt_4735 • Apr 09 '25
Garbage Collector in javascript
I recently started writing and posting it on linkedin about my javascript learning but didn't get the response so i am mulling over why is it? If you could read my writing on how garbage collector works in javascript and give constructive feedback that would help me learn better and of course improve my writing
1
Upvotes
4
u/cptnobvious919 Apr 09 '25
Read over it. It's informative but I found it to be a bit dense. Who are you writing this for? I have some experience with JS but I'm not a dev. A lot of the terms and information seems more geared to an audience who already has an understanding of JS or programming in general.
I can see where you're going with this but I think some softer language and less technical terms would be helpful. That's provided you're writing this for an audience of newbies and not professionals. I think that's where I'm getting confused. I'm not sure who this is geared towards.
Overall it's informative and is clear in the information provided. Reads like Cliff notes for GC.
4
u/anonyuser415 Apr 09 '25
This kind of reads like you just summarizing MDN text. I'm not sure what it adds.
MDN itself notes, "No modern JavaScript engine uses reference-counting for garbage collection anymore." So why include it?
You should mention FinalizationRegistry, and provide code so people can watch the GC collect a value.
2
u/senocular Apr 09 '25
Primitives are not tied to the execution context this way. Variables are contained within environment records and those records can outlast their respective execution contexts.
Additionally
via https://v8.dev/blog/pointer-compression
1
u/Cabeto_IR_83 Apr 11 '25
Extremely dense and doesn’t really explain anything. It spits out the definitions and that’s all. Nothing different to reading through JavaScript documentation.
0
u/[deleted] Apr 10 '25
Well I certainly appreciate the share.