Skip to content

Instantly share code, notes, and snippets.

@jemc
Created July 14, 2017 04:25
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 jemc/d40162202e65bd5ce49e0de35654639a to your computer and use it in GitHub Desktop.
Save jemc/d40162202e65bd5ce49e0de35654639a to your computer and use it in GitHub Desktop.
let alloc_fn = @{(size: USize): Pointer[U8] =>
@pony_alloc[Pointer[U8]](@pony_ctx[Pointer[None] iso](), size)
}
let realloc_fn = @{(p: Pointer[U8], oldsz: USize, sz: USize): Pointer[U8] =>
@pony_realloc[Pointer[U8]](@pony_ctx[Pointer[None] iso](), p, sz)
}
let free_fn = @{(p: Pointer[U8], size: USize) =>
None // do nothing - let Pony GC take care of it
}
@__gmp_set_memory_functions[None](alloc_fn, realloc_fn, free_fn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment