Last active
August 29, 2015 14:05
-
-
Save SeanTAllen/70ace1159f5e1448b07b to your computer and use it in GitHub Desktop.
An answer to your question from yesterday...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
All memory for the ring buffer is pre-allocated on start up. A ring-buffer can store either | |
an array of pointers to entries or an array of structures representing the entries. | |
The limitations of the Java language mean that entries are associated with the ring-buffer | |
as pointers to objects. Each of these entries is typically not the data being passed itself, | |
but a container for it. This pre-allocation of entries eliminates issues in languages that | |
support garbage collection, since the entries will be re- used and live for the duration of | |
the Disruptor instance. The memory for these entries is allocated at the same time and it is | |
highly likely that it will be laid out contiguously in main memory and so support cache striding. | |
There is a proposal by John Rose to introduce “value types”5 to the Java language which would allow | |
arrays of tuples, like other languages such as C, and so ensure that memory would be allocated | |
contiguously and avoid the pointer indirection. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment