The JsonReyclerPools#LockFreePool object takes up a large amount of memory
zhanbei1 opened this issue · 5 comments
Search before asking
- I searched in the issues and found nothing similar.
Describe the bug
Using com. fasterxml. jackson. core: jackson-databind: 2.17.1 version.
And use the following code:
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.enable(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature())
.enable(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS.mappedFeature())
.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
OBJECT_MAPPER operates on string or Json data.
But this is often my code OOM. Looking at the JVM memory, objects in old_gen keep growing and are hard to gC-drop.(JVM Heap is 2G)
The hprof file generated after OOM occurs, using visualVM: 2.1.8 version, carries on the analysis, discover com. fasterxml. jackson. core. util. JsonReyclerPools# LockFreePool
object occupies a lot of memory, and there is some json string type.
May I ask what caused this? Did I use it wrong?
Version Information
jackson-databind:2.17.1
Reproduction
<-- Any of the following
- Brief code sample/snippet: include here in preformatted/code section
- Longer example stored somewhere else (diff repo, snippet), add a link
- Textual explanation: include here
-->
// Your code here
Expected behavior
No response
Additional context
No response
The VERY FIRST THING to try is the LATEST PATCH VERSION of minor version you have.
This would be 2.16.2.
This is, in fact, something you should have already tried before filing an issue.
So please try that now.
But also -- just in case -- please double-check you know the exact version of jackson-core
you have. Only Jackson 2.17.0 change the default pool to "lockFreePool".
Finally, I will move this issue to its proper place, jackson-core
repository where Recycler Pools reside.
The VERY FIRST THING to try is the LATEST PATCH VERSION of minor version you have. This would be 2.16.2.
This is, in fact, something you should have already tried before filing an issue.
So please try that now.
But also -- just in case -- please double-check you know the exact version of
jackson-core
you have. Only Jackson 2.17.0 change the default pool to "lockFreePool".Finally, I will move this issue to its proper place,
jackson-core
repository where Recycler Pools reside.
I'm very sorry, I just got the version number wrong, the version I used is 2.17.1, my comment has been updated. Find a similar issue:FasterXML/jackson-databind#4500
It is not known if this issue has been fixed in a later version
Issue was indeed fixed by default change in 2.17.1 (as noted in the issue you mention); the problem did affect 2.17.0 (and only 2.17.0).
The only way LockFreePool
would be used with 2.17.1 is if application code explicitly configured it to be used.
So I would make sure that the version you use is 2.17.1 (or 2.17.2 which is being released today).
Specifically jackson-core
version: jackson-databind
does not control RecyclerPool configuration in any way.
If problem seems to occur with jackson-core
2.17.1, also ensure that there is no configuration override to change the recycler pool to LockFreePool
.
Issue was indeed fixed by default change in 2.17.1 (as noted in the issue you mention); the problem did affect 2.17.0 (and only 2.17.0).
The only way
LockFreePool
would be used with 2.17.1 is if application code explicitly configured it to be used. So I would make sure that the version you use is 2.17.1 (or 2.17.2 which is being released today). Specificallyjackson-core
version:jackson-databind
does not control RecyclerPool configuration in any way.If problem seems to occur with
jackson-core
2.17.1, also ensure that there is no configuration override to change the recycler pool toLockFreePool
.
Ok, I have understood. Thank you very much for your reply. And I'm going to close this Issue
Thank you @zhanbei1 ! I hope things resolve as expected, best of luck.