Skip to content
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

use GC.malloc_atomic to allocate objects without pointers #4081

wants to merge 1 commit into from


Copy link

@kostya kostya commented Feb 26, 2017

bdwgc recommend to use malloc_atomic ( to allocate binary data. I apply this to some places, but there is actually much more places, that can be optimized. for example, or better Pointer(T).malloc choose to use atomic if T is not reference.

Copy link

asterite commented Mar 2, 2017

I've thought about making Pointer(T).malloc use GC.malloc_atomic if T doesn't have references (the check is trivial for primitive types but a bit more tricky for other types, for example structs). The only gotcha would be to do something like Pointer(UInt8).malloc(size).as(SomeReferenceType) but for those cases we can probably use Pointer(Void) and document that Void should be used in those cases (and we consider Void as potentially having inner pointers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants