further improvement to memory analysis