taking handler and onError functions out of memory footprint calculation