graphics: avoid reallocating the memory block if the size is the wanted size