Yeah, setting to null (if that's the last pointer, so it's not in any arrays, lists, global/local variables etc) will kill it off when the GC next collects. But it won't kill it from VRAM. I sometimes use it to clean out memory when I change screens or something. However, often it's not needed like if you have a TImage field on a type, when the type is killed, the TImage is automatically killed too. (same with sounds but NOT the same with TChannels)
There is a way to precache images in VRAM. So rather than killing out old ones, I just make sure the ones for the current screen are precached before the first draw. If the VRAM is small, the card should automatically overwrite the older textures.
Maybe there are fancy DX/OGL commands to kill out textures from VRAM.
|