This commit uses global pre allocated work space to dramatically reduce memory usage and allocation time