add memchk.py to check memory leaks