This function removes unused weight maps (maps with no weights assigned or only zero values assigned) of the active Object in edit mode and Weight Paint mode.
Note: In the operator Redo panel you find a few options for changing the behavior of this operator right after you called it (see below).
When the viewport is in Objkect Mode you get an additional crossed bones icon. When hitting this icon, then the operator is applied to all currently selected objects.
In the operator Redo Panel you can set some options to remove only specific subsets of weight groups. See the option tool tips for more detailed information.