Trying to avoid garbage collection on stream