4 ms·
I didn't realize that the GC copied the surviving objects to a separate location. Come to think of it, i don't actually know how the GC keeps track of what obje
by algorithmsRcool 2y ago
I didn't realize that the GC copied the surviving objects to a separate location. Come to think of it, i don't actually know how the GC keeps track of what object lies in what generation.
- mystified5016 2y agoGC is free to move things all over memory, though I'm not savvy enough to say why this is necessary. C# allows you to "pin" a variable to combat this. Any pinned memory will never be moved by GC, so if you pass a pointer to an object out of your managed program, the pointer address will always stay valid.
- Dwedit 2y agoIf you can't move objects around in memory, you get memory fragmentation.