mem reused in libapi