Closed vitaly-ivanov closed 2 weeks ago
the issue is same as https://github.com/datafaker-net/datafaker/issues/1263 and known, even more this behavior was mentioned in comments of https://github.com/datafaker-net/datafaker/issues/1263 so I don't see a reason to have another open issue
@snuyanzin I see, the problem is the same. Could you consider renaming #1263 as it's barely searchable as it is.
renamed
Describe the bug The PROVIDERS_MAP cache size increases when using the seeded random functionality with the doWith method.
This issue is similar to https://github.com/datafaker-net/datafaker/issues/883.
To Reproduce Code to reproduce is here: https://github.com/vitaly-ivanov/datafaker-memory-leak/blob/main/app/src/main/kotlin/org/example/App.kt
Expected behavior I think the cache should not be filled while using the
doWith
block method as it wraps the callable.Versions:
Additional context Our aim is to generate the same values for the same random seed. The number of values can be very large.
The fix does not work in this case because new instances of the
RandomService
andRandom
classes are used.But even if the random seed is the same, the equals method returns false because
java.util.Random' does not override the
equals' and `hashCode' methods.