test codes for capture mem
continue work --- still not finished yet.