reimplement NodeAllocator in C