The first OutOfMemoryError in that log does not seem to have much to do with the upload, it apparently happens while resizing an attachment when displaying it.
Feels more like the problem is that all attachments are resized at the same time when showing the attachment tab.
I remember we discussed introducing some resize pull pool, or a more generic "expensive stuff" pool in a few other issues.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.