-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add live graphic visualization of memory allocated/freed while nodeos is running #1041
Draft
greg7mdp
wants to merge
21
commits into
main
Choose a base branch
from
mem_occup_vis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+61
−5
Conversation
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
greg7mdp
force-pushed
the
mem_occup_vis
branch
from
November 21, 2024 20:34
b0bebe1
to
9b12e69
Compare
Note:start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please note that we do not intend to merge this PR, in only exists as documentation of the work done, and as a base for further developments if warranted.
Resolves #974.
This change is mostly done in two separate parts:
Boost interprocess memory occupancy tracking
The Boost interprocess library (which is used to manage memory within the shared memory segment allocated by chainbase) can use multiple memory allocation managers.
Chainbase, and therefore nodeos, use the
rbtree_best_fit
algorithm which keeps track of free areas using a rbtree (the nodes of the rbtree are intrusively stored in the free areas themselves, so there is no additional memory cost for this tree, besides the fact that it requires a minimum allocation size).This PR adds a new member in the memory segment header managed by the
interprocess
library, of the type:and updates this occupancy vector:
bool initialize_occupancy();
is calledAs we cannot add these changes in the original boost repo, this PR links to a private repo which includes the changes in the
interprocess
library. These changes are also included in the following file:ip.txt
Use the occupancy vector maintained by
Boost interprocess
to update a texture and visualize it on-screenThe visualization is implemented using
OpenGL
. This required adding some dependencies to chainbase:glad
header files describing the OpenGL interface used. These were generated from https://gen.glad.sh/, specifyinggl 4.6
andglx 1.4
,compat profile
,header only
,GL_ARB_direct_state_access
extension.glfw.txt
The visualization is implemented in the new files
mem_visualizer[.hpp, .cpp]
, and takes place on a separate thread.Notes
rbtree_best_fit
memory allocator (as chainbase does), the minimum size of a block is 48 bytes. When allocating 8 bytes, the overhead is 40 bytes. When allocating 32 bytes or more, the overhead is 16 bytes.m_prev_size
andm_size
) with two 1 bit flags encoded in the lower two bits ofm_size
(m_prev_allocated
andm_allocated
).