Merge "fixing problem with allocating too much memory to a surface by fixing the size of the surface when it exceeds a threshold and resizing the surface when it falls beneath the threshold."