This tiny little script deletes all small features in all layers. This works fine but the size of .shp files are not reduced. Please tell me why...
canvas = iface.mapCanvas()
expr = QgsExpression("$length<100")
for l in canvas.layers():
l.startEditing()
it = l.getFeatures(QgsFeatureRequest(expr))
for ft in it:
l.deleteFeature(ft.id())
l.commitChanges()