How the GC distinguishes code from data

%u wfunction at
Wed Jan 5 13:51:19 PST 2011


There's a question that's been lurking in the back of my mind ever since I
learned about D:

How does the GC distinguish code from data when determining the objects to
collect? (E.g. void[] from uint[], size_t from void*, etc.?)

If I have a large uint[], it's practically guaranteed to have data that looks
like pointers, and that might cause memory leaks. Furthermore, if the GC moves
things around, it would corrupt my data. How is this handled?

Thank you!

More information about the Digitalmars-d-learn mailing list