Hibernate out of memory exception while processing large collection of elements

后端 未结 4 1863
野性不改
野性不改 2020-12-18 05:25

I am trying to process collection of heavy weight elements (images). Size of collection varies between 8000 - 50000 entries. But for some reason after processing 1800-1900 e

4条回答
  •  春和景丽
    2020-12-18 05:59

    I don't know why you think committing a transaction frees heap memory. Running garbage collection does that.

    OOM error can happen if your perm gen is exhausted.

    The easy answer is to change your min and max heap sizes and perm gen size when you start the JVM and see if it goes away.

    I'd recommending getting a profiler, like VisualVM, and seeing what is consuming your memory at runtime. It should be easy to fix.

    I'd guess that you're trying to commit too large a chunk at once. Break it up into smaller pieces and see if that helps.

提交回复
热议问题