Because this will cause problems, when m_fg is not allocated dynamically. e.g. CFactorGraph fg; CMAPInference infer(&fg, TREE_MAX_PROD); 
I tried this will cause segmentation fault. Is there better way to deal with this case?