if anyone interested:
I have just read my basic info about Garbage collection and I have found the solution.
It is a matter of using loops appropriately: I had 4 Loops searching for users and then a loop going through products and trying to update with previously found user. Except as these users where found in another loop the Garbage collector defined them as being removable from memory.
Now I have a code that takes longer but works as for each user, I call a function that updates all Products to ensure we do not loose the user definition