Malloc API and tests