initial work for ZTS build (with no malloc hook which are not thread safe)