the code reads lines of CSV file like:

`Stream<String> strings = Files.lines(Paths.get(filePath))`

then it maps each line in the mapper:

`List<String> tokens = line.split(",");
 return new UserModel(tokens.get(0), tokens.get(1), tokens.get(2), tokens.get(3));`

and finally collects it:

`Set<UserModel> current = currentStream.collect(toSet())`

File size is ~500MB
I've connected to the server using jconsole and see that heap size grew from 200MB to 1.8GB while processing.

I can't understand where this x3 memory usage came from - I expected something like 500MB spike or so?

My first impression was it's because there is no throttling and garbage collector simply doesn't have enough time for cleanup.
But I've tried to use guava rate limiter to let garbage collector time to do it's job but result is the same.