memorycheck Logic is simple just add AOP in malloc and free and record all those action and make sure all malloc area is been free.