implemented check for free v_mem

Change-Id: Ibf180515461ee8c3fb8dd4a9ef4a96f89a3d1e4f