Hi Scott,
Nice find! Could you drill into one of the LockMode loaders and see what the larger
objects referenced by that are?
Largest objects are of type BatchingEntityLoader.
The problem has to do with the value of hibernate.default_batch_fetch_size.
In our case we use 16 as the value. In this case Hibernate creates 11 EntityLoaders
for every entity class involved in a collection association. So the most memory
is consumed by generated SQL statements. If I compare memory snapshots,
I see ca. 100MB more of String objects in JBoss 7 as in JBoss 4.
Changing the value of hibernate.default_batch_fetch_size from 16 to 4
reduces the size of SessionFactoryImpl in our case from ca. 370MB to 180MB.
And if I use patched version of Hibernate as suggested by me, the size of
SessionFactoryImpl is ca. 80MB. So we will now investigate, wether it is
really needed to set hibernate.default_batch_fetch_size to 16 or maybe
the lower value would also give us decent performance.
Best regards
Andrej Golovnin