helper function of allocateMatrix and enableBuffer