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

Excessive EntryEventType[] allocations #11777

tbabinski opened this issue Nov 10, 2017 · 2 comments

Excessive EntryEventType[] allocations #11777

tbabinski opened this issue Nov 10, 2017 · 2 comments


Copy link

@tbabinski tbabinski commented Nov 10, 2017

A high number EntryEventType[] are created in a client application which receives many entry events. In a specific application, EntryEventType[] dominates the application's overall memory allocation.

entryeventtype allocations

I suspect that this is the result of a leak in EventryEventType.getByType(final int eventType). That method calls EntryEventType.values(), which allocates a new array on each call. If this suspicion is correct, a fix could be to cache the values array in a private static variable.

Hazelcast version 3.9 running on java 9

Copy link

@mdogan mdogan commented Nov 13, 2017

EventryEventType.getByType(final int eventType) can be implemented via switch/case:

switch (eventType) {
    case Type.ADDED:
        return ADDED;
    case Type.REMOVED:
        return REMOVED;
    case Type.UPDATED:
        return UPDATED;
    case Type.EVICTED:
        return EVICTED;
    case Type.EVICT_ALL:
        return EVICT_ALL;
    case Type.CLEAR_ALL:
        return CLEAR_ALL;
    case Type.MERGED:
        return MERGED;
    case Type.EXPIRED:
        return EXPIRED;
    case Type.INVALIDATION:
        return INVALIDATION;
Copy link

@tbabinski tbabinski commented Nov 13, 2017

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants