add memory cost measure