I would like to use `cudaHostAlloc` as a custom allocator. It's a replacement to C `malloc` that
* allocates page-locked memory * greatly improve Host<->GPU memory transfer via Direct Memory Access * enable non-blocking host<->GPU memcpy w.r.t. both host and GPU computations Here is [Nim implementation](https://github.com/unicredit/nimcuda/blob/82c0bf43ff94d4839e233d7d2a0735345b66c8b4/nimcuda/cuda_runtime_api.nim#L3228) proc cudaHostAlloc*(pHost: ptr pointer; size: csize; flags: cuint): cudaError_t {.cdecl, importc: "cudaHostAlloc", dynlib: libcudart.so.} **Questions** 1\. Is it possible to replace the default memory allocator for say `seq`? 2\. If not is it possible to use a custom memory allocator for a custom ref object? I had a look at [Nim's memory regions](https://nim-lang.org/docs/manual.html#types-memory-regions) I have a feel that it may help but I don't understand how to use it in practice. type UncheckedArray {.unchecked.}[T] = array[0..100_000_000, T] PinnedArray[T] = ref object len: int data: UncheckedArray[T] # Allocate 50 kB # this will be replaced by cudaHostAlloc code var memRegion = alloc(50_000) # Doesn't compile var foo: PinnedArray[int] ptr memRegion # I get "Error: type expected" # Nimsuggest also says "region needs to be an object type"
