checking output heap at return statements