Every time the render method is executed new Color object is created for the intensity. New constant Colors are created for the Level class to improve the memory leak issue.
Thanks! These changes indeed reduce the heap allocations, but the new Color objects were eventually freed, so it was not a memory leak, that would be way worse :)
Every time the render method is executed new Color object is created for the intensity. New constant Colors are created for the Level class to improve the memory leak issue.