MaxSizePolicy based on how much free memory there is available

Related to the discussion at #3811

Dont know if that is something you guys wanna to integrate, but I will use for sure =D