Move count buffers from stack to heap

This fixes the stack overflow issue on MSVC build.

Change-Id: Icb0a78e5992a097d2192979ec2432546eaa452dd
2 files changed