Start of BlockMemory allocator, and couple minor fixes

- BlockMemory class will be used by script engine to allocate
  dynamic types (e.g. string and eventually dicts and lists)
- Also fixed a math error which was breaking a unit test
- And some minor code cleanup