Upgrade to JDA 5 beta 13
Everything is the same except for the new way to upload files, instead of loading the file in memory then uploading, it streams the file as it uploads. This should help with the runtime memory.
Source: https://github.com/discord-jda/JDA/releases/tag/v5.0.0-beta.13