[
https://issues.apache.org/jira/browse/ARTEMIS-1622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16331935#comment-16331935
]
ASF GitHub Bot commented on ARTEMIS-1622:
-----------------------------------------
Github user franz1981 commented on the issue:
https://github.com/apache/activemq-artemis/pull/1791
I've already run CI on it and it seems to be safe.
Just few numbers to justify it...
On master:

While with this PR:

800 MB vs 640 MB = 160 MB saved bytes
Given the default broker settings for the JVM the math is:
- each `Node` instance is 32 bytes = 12 bytes obj header + 16 bytes of
fields + 4 bytes of padding to have 8 byte alignment
- the original `MessageReferenceImpl` was 48 bytes, including a 12 bytes
header
- this PR `MessageReferenceImpl` is 64 bytes = 48 bytes (of the original) +
16 bytes (of `Node`) + 0 bytes of padding (64 is already 8 bytes aligned)
We're saving 4 bytes of padding and 12 bytes of Object header from `Node` =
16 bytes for each message entry.
If we have 10_000_000 messages we're saving 160 Megabytes.
IMO there are few other checks to be performed and need anyone that knows
how the original LinkedListImpl works, but the change is easy to be reverted:
I've already checked that there aren't evident memory leaks, but any feedback
is appreciated :+1:
> Reduce memory footprint of QueueImpl
> ------------------------------------
>
> Key: ARTEMIS-1622
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1622
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Environment: QueueImpl is backed by LinkedListImpl that allocates a
> Node for each message reference: reducing the footprint will help GC and
> allow more precise memory estimation to tune the heap.
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)