a manual memory management exercise