The command File →
Vacuum Defs removes unused definitions from
the <defs> section of
the SVG file. This includes things like unused gradients,
patterns, and markers.
Due to the mechanism that Inkscape uses to keep track of which
definitions are in use, it may be necessary to close a file and
reopen it before this command will remove all