Re-write console code to use a static buffer instead of multiple calls to malloc/free to avoid heap fragmentation.