The tag has no wiki summary.

learn more… | top users | synonyms

29
votes
15answers
15k views

Why do languages such as C and C++ not have garbage collection, while Java does?

Well, I know that there are things like malloc/free for C, and new/using-a-destructor for memory management in C++, but I was wondering why there aren't "new updates" to these languages that allow the ...
17
votes
7answers
3k views

Why does Garbage Collection only sweep the heap?

Basically, I've learned so far that garbage collection erases forever any data structure that is not currently being pointed to. But this only checks the heap for such conditions. Why doesn't it also ...
11
votes
2answers
786 views

Is there a need for garbage collection in a stack-based language?

What is the need for garbage collection (GC) in a stack-based language? In a language like Forth or RPL (on HP calculators), is there a need for garbage collection? I would think, since output is ...
12
votes
4answers
964 views

What are the algorithms behind low pause GC?

Some languages, for exemple java, introduced a low pause GC. Those GC can do most of the work without pausing the whole world. This is obviously a quite hard problem because it require to analyze the ...
27
votes
5answers
54k views

Stack and Heap memory in Java

As I understand, in Java, stack memory holds primitives and method invocations and heap memory is used to store objects. Suppose I have a class class A { int a ; String b; ...
3
votes
2answers
400 views

Best refresher material on Java Garbage Collection? [closed]

I haven't looked at Java Garbage Collection for a while and feel the need for a refresher on it. Anyone recommend a resource or two?
4
votes
8answers
2k views

How common are circular references? Would reference-counting GC work just fine?

How common are circular references? The less common they are, the fewer hard cases you have if you are writing in a language with only reference counting-GC. Are there any cases where it wouldn't ...
26
votes
9answers
5k views

Why Garbage Collection if smart pointers are there

These days, so many languages are garbage collected. It is even available for C++ by third parties. But C++ has RAII and smart pointers. So what's the point of using garbage collection? Is it doing ...