smalloc: initial smart memory allocator

Other classes that require external memory should allocate it though
smalloc. This will automatically handle pooling and cleanup. Also by
centralizing how external memory is handled it will be easier to make
performance adjustments.