optimizing memory usages of HAC-LW