How do I delete objects not linked in any scene?

I have a couple of rigs set up with bones with custom shapes. I have long ago deleted the objects themselves, as I didn’t want them cluttering up my scene layers, and this did not remove the links to the objects in the rig, so I thought I was okay.

But sometimes I am trying to remove the rig from a file. In that case, I delete the armature object containing all the references to the objects, but the objects and all their materials, (and all the node trees in those materials, and all the mesh data, and so on and so forth,) persist within the files. For materials, I can clear out the ones I do not want by control+clicking the remove ‘x’, but for every other type of data, I seem to be stuck with this undetectable clutter.

My previous attempts to find an answer to this question have been fruitless; I apologize if it is terribly obvious. Thank you in advance for whatever help you can provide.

Edit: I just tried a file I’d been having this problem on and the phantom data was indeed gone. Perhaps I have simply not been clearing out references to the unwanted objects thoroughly enough? In any event, I apologize if this is not a problem; I might have just found the solution, after all.

I think if you do that work of deleting the stuff and then saving and opening, that might be all it takes.