I'm using very big memory layers:
Is there any way to empty (fast), destroy or clean a layer in memory from an script without exit from this script ?
I'm using very big memory layers:
Is there any way to empty (fast), destroy or clean a layer in memory from an script without exit from this script ?
Have you tried
del(layer)
These should remove the reference to the layer and call the layer destructor.
In your script you can use:
QgsMapLayerRegistry.instance().removeMapLayer(mem_layer.id())
assuming that the name of memory layer is 'mem_layer'.