can a GC be implemented with C++ raw pointers? -


I was thinking that the garbage collector can be implemented with full power of C ++ pointsers. Also, in languages ​​like Java, I can not specify the literal addresses for references. It is very flexible in C ++.

I believe that there are both in C #, but then, in C #, the insecure indicator is the responsibility of the programmer.

EITD :: People, if I am currently in C ++ Points, then what can be done in GCI or not? Pointer arithmetic is not a fundamental problem. GC's are all being fixed again, and the indicator is being done all the time.

Arithmetic is another example of that. (Of course, if indicative arithmetic is allowed between the indicators pointing to different buffs, then this can cause problems, but it is not. The only arithmetic that allows you to display on the pointer pointing in an array It is the one who restores it within that array.

The real problem is the lack of metadata. A GC should know what the indicator is and what does not

If this value has to be faced with 0x27a2c230 , it should be able to determine what it is

  • An indicator ( In that situation, the marker has to be followed to mark the destination in it
  • An integer (the same value is a fully valid integer, maybe this is not an indicator)
  • Or Something else, say, a little string.

It should also be able to determine the extent of a structure. Assuming the value is is an indicator, and it points in another structure, GC should be able to determine the size and extent of that structure, so it knows which category of address More points should be scanned.

There are several basic facilities to deal with this in GCAd languages. C ++ does not.

You can usually find the closest to Bohem's GC, and it is conservative in it that if may be is an indicator, then GC is the one, which means that Some data is kept inexplicably alive. And therefore, it should be GCAID, which is likely to keep alive.

Alternatively, of all the basic infrastructure may be to be added in principle in the C ++ compiler, there is no rule in the standard that it is not allowed to exist is. The problem is that this will be a major performance hit and will eliminate many opportunities of optimization.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -