Move all buffers from stack to BSS segment

The only drawback is making functions non thread-safe.
But it's not required since we use mutex to guard them.
Replace `metric_format_name` function, update tests
Merge pull request #12 from rampage644/tests

Tests