I'm not sure how we would run into a case where we have more pointers than allocated heap nodes on the stack? I've tried to understand the mark and sweeping faces, that frees unreachable nodes, but when would we have more pointers than nodes?
Asked
Active
Viewed 89 times
0
-
2My first thought is that `mark and sweep` refers to garbage collection algorithms, which _[really have nothing to do with the C language](https://softwareengineering.stackexchange.com/questions/113177/why-do-languages-such-as-c-and-c-not-have-garbage-collection-while-java-does)_. Should this be tagged with C# rather than C? – ryyker Feb 15 '19 at 12:54
-
I think the question needs more context before a good answer can be provided. The answer could be lots of things (pointers are invalid, pointers are pointers to inside objects, pointers are not all unique). Or perhaps it can never happen. It's also hard to parse the question -- what is an allocated heap node on the stack? – Paul Hankin Feb 15 '19 at 13:41
-
This sounds like an interesting question, although I completely do not have idea what exactly you are asking about... Could you please provide more details? – Konrad Kokosa Feb 15 '19 at 13:41
-
What do you mean with “nodes”? Objects? You can have an arbitrary number of pointers to the same object. But what’s the actual problem? – Holger Feb 15 '19 at 16:22