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
{{ message }}
This repository was archived by the owner on Feb 5, 2019. It is now read-only.
This is coming with the bundled jaxb of jdk1.6.0_21.
For this reason storing references to marshallers is not a good idea if you last time marshalled some huge files.
The class is for testing purposes in the attachment. The first argument is package name the second is a unicode xml file. If it is not unicode change the encoding in inputstreamreader. Use big file about 100 MB to see the problem nice way. I attached a screenshot about the heapdump (stopped by debugger) after the line "Trying to release writer locally - nothing happened. Small change is there because string is collected".
I would recommend to do some similar test for unmarshaller and a bytearrayinputstream for example. Is it holding the reference or not?
Example test output:
Test started. Package:biz.i2z.model.content.jaxb, file: c:\2\cucc4, filesize (UNICODE FILE) in mb: 148
MAX : 1450 mb
FREE : 12 mb
TOTAL: 15 mb
Object tree constructed.
MAX : 1450 mb
FREE : 310 mb
TOTAL: 535 mb
State after serialization
MAX : 1450 mb
FREE : 821 mb
TOTAL: 1450 mb
Trying to release writer locally - nothing happened. Small change is there because string is collected.
MAX : 1450 mb
FREE : 969 mb
TOTAL: 1450 mb
Reusing the marshaller released memory
MAX : 1450 mb
FREE : 1225 mb
TOTAL: 1450 mb
Serializing again to get a new proof
MAX : 1450 mb
FREE : 821 mb
TOTAL: 1450 mb
The memory is freed because the buffer that is held by marshaller/xmlserializer/xmloutput is truncated.
MAX : 1450 mb
FREE : 1226 mb
TOTAL: 1450 mb
This is coming with the bundled jaxb of jdk1.6.0_21.
For this reason storing references to marshallers is not a good idea if you last time marshalled some huge files.
The class is for testing purposes in the attachment. The first argument is package name the second is a unicode xml file. If it is not unicode change the encoding in inputstreamreader. Use big file about 100 MB to see the problem nice way. I attached a screenshot about the heapdump (stopped by debugger) after the line "Trying to release writer locally - nothing happened. Small change is there because string is collected".
I would recommend to do some similar test for unmarshaller and a bytearrayinputstream for example. Is it holding the reference or not?
Example test output:
Test started. Package:biz.i2z.model.content.jaxb, file: c:\2\cucc4, filesize (UNICODE FILE) in mb: 148
MAX : 1450 mb
FREE : 12 mb
TOTAL: 15 mb
Object tree constructed.
MAX : 1450 mb
FREE : 310 mb
TOTAL: 535 mb
State after serialization
MAX : 1450 mb
FREE : 821 mb
TOTAL: 1450 mb
Trying to release writer locally - nothing happened. Small change is there because string is collected.
MAX : 1450 mb
FREE : 969 mb
TOTAL: 1450 mb
Reusing the marshaller released memory
MAX : 1450 mb
FREE : 1225 mb
TOTAL: 1450 mb
Serializing again to get a new proof
MAX : 1450 mb
FREE : 821 mb
TOTAL: 1450 mb
The memory is freed because the buffer that is held by marshaller/xmlserializer/xmloutput is truncated.
MAX : 1450 mb
FREE : 1226 mb
TOTAL: 1450 mb