Memory usage when querying users

In your example, you are getting all the fields in the get_users call, but you are only really using the ID and display_name fields. So you can save some memory by forcing get_users to only get the fields you need.

$users = get_users(array(
  'role'=>'s2member_level3', 
  'fields'=>array('ID', 'display_name'),
));

That will help reduce your memory footprint.