ENG-6361

...nt

Also bypass the bug of ENG-6517 by using inequality checking instead of equality checking.

Still need to discuss on the test case which indicates the peak memory usage is larger than the "current" memory usage.