Java BigDecimal memory usage?

后端 未结 2 1363
醉话见心
醉话见心 2020-12-03 13:45

Is there a guideline for estimating the amount of memory consumed by a BigDecimal?

Looking for something similar to these guidelines for estimating

2条回答
  •  Happy的楠姐
    2020-12-03 14:33

    If you dig into the internals of BigDecimal you'll see that it uses a compact representation if the significand is <= Long.MAX_VALUE. Hence, the memory usage can vary depending on the actual values you're representing.

提交回复
热议问题