| Attached is an example project that simply opens an EntityManagerFactory and closes it, forever, with no entity classes. When this project is built into a single jar, including Hibernate and its dependencies, an increasing amount of memory is used outside of the Java heap, up to several GB, and this does not happen when the project is run as separate jars. As the screenshot shows, the memory appears in ps as resident, but does not appear in JVisualVM's graph of the heap size. (It's also not in the PermGen, although that's not in the screenshot.) Adjust the DB details at the top of RunHibernate.java, run ant dist to build, and then run run-combined.sh or run-separate.sh, and note the different memory behaviour. |