Eliminate race condition while initializing the on-chip heap

Fixes #33