Ideally, the storage needs to be completely changed to support the need covered by ExtensionJobHistory#getRecords() without having to load them all in memory.
But an easier middle ground would be to change a bit the logic to load existing job history files only the first time getRecords is called (so when actually accessing the extension history UI), and keep in memory only what is asked (which by default is only the last 10). So make what is in memory more of a cache than the full storage.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.