You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add maximum buffer size cap to ByteArrayOutputStream
Cap individual buffer allocations to 16MB to prevent excessive memory usage.
The previous implementation allowed buffers to double indefinitely, which could
lead to very large single allocations (32MB, 64MB, 128MB, etc.) that contribute
to heap exhaustion.
With this cap, when more than 16MB of data needs to be stored, the
ByteArrayOutputStream will create multiple 16MB buffers instead of one giant
buffer. This spreads the memory allocation across multiple smaller chunks
and prevents heap fragmentation issues.
Combined with the reduced threshold in ConcurrentJarCreator, this provides
defense-in-depth against OutOfMemoryError during zip archive creation.
Co-authored-by: slachiewicz <[email protected]>
0 commit comments