Yes, it consumes memory. But this is due to the level cache and would be no different with an engine based function.

You can use ent_purge to clear removed terrain from the video memory, and level_free to clear it from the level cache.