datafaker-net / datafaker

Generating fake data for the JVM (Java, Kotlin, Groovy) has never been easier!

Home Page:https://www.datafaker.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak in PROVIDERS_MAP

lukelast opened this issue · comments

Describe the bug
Each instance of Faker() created will permanently consume memory. If you create enough instances you'll OOM.

To Reproduce
Code to reproduce is here:
https://github.com/lukelast/datafaker-bug-repro/blob/main/src/main/kotlin/Main.kt

The summary of the code is to create a lot of instances, let them be GC'd, then check heap usage.

Expected behavior
I expect heap usage to go back to the original size as everything is GC'd away.

Versions:

  • OS: Windows, Linux
  • JDK: 17, 20
  • Faker Version: 2.0.1

Additional context
image
MicrosoftTeams-image

thanks for reporting
the problem was in absence of hashcode/equals
there is a fix available for that

Closing, since it was fixed at 4ce8d05