Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always leads to OutOfMemoryError when we use large scalar random keys #9

Open
xfeep opened this issue Apr 29, 2015 · 3 comments
Open

Comments

@xfeep
Copy link

xfeep commented Apr 29, 2015

        Map<Long, Object> map = new NonBlockingHashMap<Long, Object>();
        for (long i = 0;;i++) {
            map.put(i, i);
            map.remove(i);
        }
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at org.cliffc.high_scale_lib.NonBlockingHashMap$CHM.resize(NonBlockingHashMap.java:863)
    at org.cliffc.high_scale_lib.NonBlockingHashMap$CHM.access$3(NonBlockingHashMap.java:794)
    at org.cliffc.high_scale_lib.NonBlockingHashMap.putIfMatch(NonBlockingHashMap.java:649)
    at org.cliffc.high_scale_lib.NonBlockingHashMap.putIfMatch(NonBlockingHashMap.java:354)
    at org.cliffc.high_scale_lib.NonBlockingHashMap.put(NonBlockingHashMap.java:313)

It is really serious bug because this make it unusable in many cases.

Same issue was addressed at

  1. https://sourceforge.net/p/high-scale-lib/bugs/14/
  2. http://jsr166-concurrency.10961.n7.nabble.com/Unexpected-memory-usage-in-NonBlockingHashHashMap-td9913.html

In the README file please add some notices about its limitation .

@Clownsw
Copy link

Clownsw commented Jan 19, 2024

This problem is serious, how can I avoid it?

@jasondevj
Copy link

i just got on my feed, you should never do this, this is not a bug. why would someone want to add something and remove it?

@Clownsw
Copy link

Clownsw commented Jan 21, 2024

i just got on my feed, you should never do this, this is not a bug. why would someone want to add something and remove it?

In some hot operations, this is indeed the case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants