Using new instead of malloc is required for proper initialization of C++ classes.
Compiling readwritesplit as C++ allows the use of C++ containers.