Implements truncate function

Currently truncate memory table returns success but actually calling an
Unit function. It is implemented in this change.