抱歉这么简单的问题,但我是 Java 新手(通常用 c 编写)
new in 循环删除对象的旧实例?
我需要类似的东西
for(;;)
{
// work on here pixels[]
source = new MemoryImageSource(200, 200, pixels, 0, 50);
image = createImage(source;
// then use image here
}
我只需要到上面,每帧新包装source
和image
对象,不想麻烦删除它,而且我不想存储大量它们作为内存泄漏,
它会被自动删除吗?是不是繁重的操作?