Will the GC scan this pointer?

Lass Safin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 24 04:03:11 PDT 2016


// Omitting the required imports.

void[] ptr;

void main() {
     uint buffer;
     glCreateBuffers(1, &buffer);
     // Filling the buffer with data and such...
     ptr = glMapNamedBufferRange(buffer, 0, 512, GL_MAP_WRITE_BIT 
| GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT)[0 .. 512];
}

So the question is: Will the GC scan ptr? As you can see, it is a 
write-only pointer, so reading from it will cause undefined 
behavior (such as return data which looks like a pointer to 
data..), and can potentially be reallly slow.

Do I have to mark it with NO_SCAN each time I call 
glMapNamedBufferRange?


More information about the Digitalmars-d-learn mailing list