I think anchoring might be at fault: the matches returned by
preg_match_all don't overlap and once you anchor your pattern to the ends of the string, there can only be one match running from
$. All the parenthesised sub-matches get drawn from that, so with only one match found, there's only one space-digit group found (which one it is and why - who knows? Maybe as the regexp engine matches more and more of the string, the group 1 submatch gets repeatedly overwritten, with only the last one written surviving).
There's probably a regexp solution, but to get on with things I'd just check the overall format of the line and then match
$num_matches = preg_match_all("/^mem:(\s+\d+)+$/", $str) and
$num_matches = preg_match_all("/\s+\d+/", $str, $matches);
And then come back to it later.
Or if you don't actually need the spaces maybe
$matches = preg_split('/\s+/', $str) and check that the 0th element returned is
mem: and the rest are