How to clear unused materials in 2.79?
As an alternative to the other answer, if the material isn't assigned to anything, select "orphaned data" in the outliner and expand the "materials" category.  you can then right-click and delete any material you don't want anymore and it will be removed from the file immediately, no need to save and reopen.