core: fix mem statistics when DBG_QM_MALLOC is on