Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Created January 12, 2022 10:54
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/b8d6531470da743700249a16912c6af4 to your computer and use it in GitHub Desktop.
Save MasterDuke17/b8d6531470da743700249a16912c6af4 to your computer and use it in GitHub Desktop.
diff --git src/core/alloc.h src/core/alloc.h
index efd562783..2aac07e18 100644
--- src/core/alloc.h
+++ src/core/alloc.h
@@ -39,7 +39,7 @@ MVM_STATIC_INLINE void * MVM_realloc(void *p, size_t size) {
MVM_STATIC_INLINE void * MVM_recalloc(void *p, size_t old_size, size_t size) {
#ifdef MVM_USE_MIMALLOC
- void *ptr = mi_realloc(p, size);
+ void *ptr = mi_rezalloc(p, size);
#else
void *ptr = realloc(p, size);
#endif
@@ -48,8 +48,10 @@ MVM_STATIC_INLINE void * MVM_recalloc(void *p, size_t old_size, size_t size) {
if (!ptr)
MVM_panic_allocation_failed(size);
+#ifndef MVM_USE_MIMALLOC
if (size > old_size)
memset((char *)ptr + old_size, 0, size - old_size);
+#endif
}
return ptr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment