Timeline for How does garbage collection work in languages which are natively compiled?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 9, 2022 at 8:14 | comment | added | Konrad Rudolph | @Peter-ReinstateMonica They’re different, but they’re still part of the runtime. | |
Oct 8, 2022 at 13:35 | comment | added | Peter - Reinstate Monica |
Are stack unwinding for exceptions and run time type information in C++ really "run time libraries" in the sense that the code for doing that is in a distinct (e.g. .dll, .lib) file, the same way that the code for printf is? Or is it built-in to the the compiler? I'm skeptical because those are language facilities that need access to language-implementation specific information, as opposed to, say, libc which needs OS-specific information but accesses those (conceptually) through standard language facilities.
|
|
Jun 17, 2017 at 11:33 | history | edited | Konrad Rudolph | CC BY-SA 3.0 |
add examples of runtime libraries to show GCs aren’t special
|
Jun 14, 2017 at 15:04 | comment | added | Chris | Yes, I admit I had worded that oddly. That was simply because I was skeptical of the compiler actual doing something like that. But now that I think about it, it does make much more sense.The compiler could simply link a garbage collector like any other part of the standard library. I believe some of my confusion stemmed from thinking of a garbage collector as only part of an interpreter implementation and not a separate program in its own right. | |
Jun 14, 2017 at 14:25 | history | edited | Konrad Rudolph | CC BY-SA 3.0 |
deleted 1 character in body
|
Jun 14, 2017 at 14:09 | comment | added | millimoose | @KonradRudolph I'm aware, but if the OP is coming from a C perspective, that is the likely misconception. (Or from the perspective of compiler construction class in whichever year of college.) And how the runtime library is used is pretty distinct from someone might imagine libraries work from the parts of them visible in programmer-written code. | |
Jun 14, 2017 at 14:01 | comment | added | Konrad Rudolph | @millimoose Runtime libraries operate behind the scenes in a multitude of ways without explicit user interaction. Consider exception propagation and stack unwinding/destructor calling. Consider dynamic memory allocation (which is usually not just calling a function, as in C, even when there’s no garbage collection). Consider handling of dynamic type information (for casts etc). So the GC really isn’t unique. | |
Jun 14, 2017 at 13:19 | comment | added | millimoose | It's not all that special, but I'd say it's somewhat special, since usually people think of libraries as something they explicitly call from their code; rather than an implementation of fundamental language semantics. I think the OP's wrong assumption here is rather that a compiler is only to translate code with a more or less straightforward way, rather than instrument it with library calls the author didn't specify. | |
Jun 14, 2017 at 12:49 | comment | added | Konrad Rudolph | @gnat I felt it was useful/necessary because the top answer not strong enough by far: it mentions similar facts, but it fails to point out that singling out garbage collection is a completely artificial distinction. Fundamentally, OP’s assumption is flawed, and the top answer doesn’t mention this. Mine does (while avoiding the rather brusque term “flawed”). | |
Jun 14, 2017 at 10:47 | comment | added | gnat | this doesn't seem to offer anything substantial over points made and explained in top answer posted 3 hours before | |
Jun 14, 2017 at 10:43 | history | answered | Konrad Rudolph | CC BY-SA 3.0 |