You didn't tell GC that the allocated memory contains pointers to GC'd data. Therefore, it thinks that the class members can be freed, which is not the case.

Adding lines
import core.memory; GC.addRange(tmp, size);
resolves the problem. You must also call GC.removeRange(tmp) when you will free the allocated memory.

      void[] mem = tmp[0..size];                           // 39
      _foo = emplace!(Foo)(mem);                           // 40

Reply via email to