Add custom memory allocator to MinGW and MacOS builds