Is it supposed to be a script to run as a work around? Once? Periodically? From the shell? From a job?
It is run as a workaround, whenever you encounter the problem. It can be run periodically if you wish. Another alternative is to limit the amount of history you retain with your jobs.
Is it a report that the script itself is the cause of the "leak"?
No, the script is not the cause of the problem. The git plugin is the cause of the problem.
It would be helpful if it was explained clearly, with instructions on what to do if you hit this problem.
I'm not sure I understand. Can you edit that wiki page to better describe it? If a user has many history records in a git job, the git plugin incorrectly stores too much information about that history within each of the individual build records. Those bloated build records are then loaded into memory, which slows Jenkins startup and makes the Jenkins process much larger than necessary.
The issue that it then points to in turn seems to suggest that the script should be run, but reading the whole thread of comments (most of which are hidden by default), even then it's far from clear whether it will help or not, or if it's always safe to run it, etc.
If you depend on the information in those bloated build records, then the script is not safe to run. Most people do not depend on the information in those bloated build records.
Another way to avoid the issue is to limit the number of build records you retain for your jobs. The configuration slicing plugin will allow you to modify the job definitions of all jobs in your system to limit the amount of history you keep for the jobs. That then avoids the problem by removing historical build records which include that duplicated information.
The output happens whenever the plugin needs to convert a name to a SHA1. That happens in several areas (like Prune stale remote tracking branches)