(bug-fix) When setting memory cap/share, also update the max memory accordingly