no memory leak on ImageBuffer rendering

Turns out, <ImageBuffer>.image creates new Image instance which will NEVER be reclaimed (which causes OutOfMemoryError) unless manually destroy()ed.


Former-commit-id: 34840cf63e52e5635ec8acd5fb1bb78923c61063
Former-commit-id: aca4388320fae022a4744f75c1b0f66b544bdafb
This commit is contained in:
Song Minjae
2017-02-25 02:39:02 +09:00
parent d7b49b0f9d
commit 3b7e88b0af
6 changed files with 61 additions and 24 deletions

View File

@@ -10,7 +10,7 @@ import org.newdawn.slick.Image
/**
* Created by minjaesong on 2017-01-07.
*/
class TapestryObject(val image: Image, val artName: String, val artAuthor: String) : FixtureBase(physics = false) {
class TapestryObject(image: Image, val artName: String, val artAuthor: String) : FixtureBase(physics = false) {
// physics = false only speeds up for ~2 frames with 50 tapestries
@@ -19,6 +19,7 @@ class TapestryObject(val image: Image, val artName: String, val artAuthor: Strin
makeNewSprite(image.width, image.height, image)
setHitboxDimension(image.width, image.height, 0, 0)
setPosition(Terrarum.appgc.mouseX, Terrarum.appgc.mouseY)
// you CAN'T destroy the image
}
override fun update(gc: GameContainer, delta: Int) {