gc: Make debug output configurable, revamp test function.

Test function needs to be called by something else. Test heap size reduced so
its dump fits on a screenful of a typical terminal.