I have created a Pdf in my Java web application and I am sending it as a e-mail attachment.
The Pdf is created as a byte[]
array. Is it better to wrap it in a ByteArrayInputStream
or should I leave it as byte[]
.
Wrapping it might be better for memory deallocation (read the accepted answer in this thread), but the downside would be that the InputStream
(if I am right) creates a copy of the array (read here ).
Which is better to avoid the possibility of having memory hogs?