expanded memory management for #5423 patches by x190