The bit in cron that uses CFG->longtimenosee to unenrol people who haven't been there for a long time was not quite working correctly.
1) get_users_longtimenosee was indexing the array on userid, which meant multiple old enrolments were being combined into one entry that missed some
2) entries where timeaccess was zero was not beng deleted ever
This means that user_lastaccess and role_assignments were growing with uneccessary entries, to the point where memory limits were reached and in the end NO unenrolments were happening at all.
On top of this:
3) The function should probably use get_recordset to avoid the memory thing totally.