WeightMap *wmap = 0; // 0 ... or ... new WeightMap
after using WeightMap * wmap = 0; the crashes disappear.
WeightMap * wmap = 0;