introduce memory test and memoryThreshold