Before validation, my memory usage is 63MB. My object graph consists of approximately 200K objects.
With my scenario, Hibernate Validator 5.0.1.Final gets an OutOfMemoryError at -Xmx512m, but succeeds at -Xmx1024m. Our more comprehensive test case has a graph of up to 10 million objects, and fails at -Xmx8g. My validators don't contain state, and the OOM errors do not have my validators in the call stack.
Is there anything I can do to reduce Hibernate Validator memory usage? The alternative would be for me to implement my own validator implementation that finds annotated classes, runs the appropriate validators, and packages its own ConstraintViolations, but I think you'll agree that that would be a pretty bad outcome.
|