Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Created January 12, 2022 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasterDuke17/d1c269498d39b2e9fccf1232c4cbffbf to your computer and use it in GitHub Desktop.
Save MasterDuke17/d1c269498d39b2e9fccf1232c4cbffbf to your computer and use it in GitHub Desktop.
MVM_STATIC_INLINE void * MVM_realloc_at_safepoint(MVMThreadContext *tc, void *p, size_t old_bytes, size_t new_bytes) {
void *allocd = MVM_realloc(p, new_bytes);
memcpy(allocd, p, new_bytes > old_bytes ? old_bytes : new_bytes);
MVM_free_at_safepoint(tc, p);
return allocd;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment