... | ... | @@ -219,3 +219,18 @@ This is why whenever you create such a resource you are responsible of disposing |
|
|
|
|
|
```
|
|
|
|
|
|
For a java developer it seems that we always reuse our color variable, however **ALWAYS, WHENEVER* we create an object with ```new``` the OS reserves the memory space! So make sure to always call ```dispose()``` on system resources before allocating a new one!
|
|
|
|
|
|
```java
|
|
|
Color colorWhite = null;
|
|
|
|
|
|
int i = 100;
|
|
|
while (i > 0) {
|
|
|
if (colorWhite != null) {
|
|
|
colorWhite.dispose();
|
|
|
colorWhite = new Color(Display.getCurrent(), new RGBA(255, 255, 255, 0));
|
|
|
}
|
|
|
i--;
|
|
|
}
|
|
|
|
|
|
``` |