Confluence currently stores the entire contents of textual attachments (like word, txt and powerpoint documents) in the search index. This is done mainly to produce excerpts that display in search results.
During index optimization the bodies of attachment are read from the disk into memory in bulk (meaning a block of memory equal to the size of all indexed & stored attachments is requested from the heap). With enough large attachments, the JVM will be asked for a large block of heap it cannot allocate and an OutOfMemoryError is produced.
The patch prevents the content of large attachments being stored in the Confluence index, and thus will:
By default, large attachment is defined as greater than 1MB.
The threshold for attachments that won't get excerpts can be modified using the system property atlassian.indexing.contentbody.maxsize, which takes a size in bytes. Eg to specify 250 kb you would use the JVM parameter:
-Datlassian.indexing.contentbody.maxsize=256000