implemented mem_resize()