Found the memory leak (d'oh), now to fix it...