-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Negative offset pointers that store array length? #266
Comments
Not needed. GC_malloc returns zeroed memory.
Yes.
A cast to size_t* is missing (you store 4 bytes but read only 1, in case of big-endian architecture it is definitely a bug).
It is OK (it should work). PS. It is better to ask question on Stackoveflow: https://stackoverflow.com/questions/tagged/boehm-gc |
Was just a type-o, just pseudocode.
So the GC wont collect the allocated memory even when nothing is directly pointing to it on the heap or stack? The GC supports checking if any ptr is pointing inside a heap object not just its ref directly? Just clarifying. Will ask future question on stack overflow. |
Yes, but you need to instruct GC at the program start to do so either by calling GC_register_displacement(sizeof(void*)) (allow pointer to have a word-size offset) or GC_set_all_interior_pointers(1) (allow pointers to any offset inside object). |
Does the bdwgc support negative offset pointers? Trying to avoid ptr arithmetic by storing the length of an array at a negative offset.
The text was updated successfully, but these errors were encountered: