-
Notifications
You must be signed in to change notification settings - Fork 380
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
Fix ACE_Shared_Memory_Pool #2077
Merged
Merged
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
* ACE/ace/SV_Shared_Memory.h:
* ACE/ace/MMAP_Memory_Pool.cpp:
* ACE/ace/Malloc_T.cpp: * ACE/ace/Malloc_T.inl: * ACE/ace/Mem_Map.cpp: * ACE/ace/Shared_Memory.h: * ACE/ace/Shared_Memory_MM.h: * ACE/ace/Shared_Memory_Pool.cpp: * ACE/ace/Shared_Memory_Pool.h:
…m shared memory segments when we don't use them anymore. At the moment the memory pool is destroyed also let the OS release all resources * ACE/ace/Shared_Memory_Pool.cpp: * ACE/ace/Shared_Memory_Pool.h:
* ACE/ace/Shared_Memory_Pool.cpp:
* ACE/examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp:
* ACE/tests/SV_Shared_Memory_Test.cpp:
…ith older ACE versions * ACE/ace/Shared_Memory_Pool.cpp: * ACE/ace/Shared_Memory_Pool.h:
mitza-oci
reviewed
Jun 19, 2023
* ACE/ace/Malloc_T.h:
* ACE/ace/Malloc_T.cpp:
* ACE/ace/Shared_Memory_Pool.cpp: * ACE/ace/Shared_Memory_Pool.h:
* ACE/ace/Malloc_T.cpp:
* ACE/ace/Malloc_T.h:
mitza-oci
requested changes
Jun 20, 2023
Co-authored-by: Adam Mitz <mitza@objectcomputing.com>
* ACE/NEWS:
mitza-oci
approved these changes
Jun 20, 2023
mitza-oci
added a commit
to mitza-oci/ACE_TAO
that referenced
this pull request
Jun 22, 2023
Fix ACE_Shared_Memory_Pool (cherry picked from commit 7ee0839) # Conflicts: # ACE/NEWS # ACE/ace/SV_Shared_Memory.h # ACE/ace/Shared_Memory_Pool.cpp # ACE/examples/System_V_IPC/SV_Semaphores/Semaphores_2.cpp # ACE/tests/SV_Shared_Memory_Test.cpp
This was referenced Jun 23, 2023
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.
The ACE_Shared_Memory_Pool doesn't release the shared memory as it should on release. This leads to an increase of used shared memory on a system where part of the processes are restarted. This can be reproduced by using an OpenDDS test using shared memory where the subscriber keeps running and the publishers are each time restarted. After each restart of the publisher run
sudo pmap -p $(pidof subscriber) | grep shmid
and notice that the number of shmid mappings only increases.In high level overview the following operations should be used by ACE:
shmget()
allocates as much physical memory as you request for the segment.shmat()
programs the MMU and sets things up in the kernel so that some address range in your process maps to the segment.shmdt()
does the reverse operation and removes the mapping.shmctl()
with IPC_RMID deallocates the physical memory of the segment (marks it as free).Before this PR ACE didn't use
shmdt
at all, onlyshmctl
was used on release. In order to useshmdt
we need to store the addresses returned byshmat
and we also need to keep the shmid of the first segment in a member variable as we can't read it from the shared memory segment itself because after callingshmdt
we can't read that memory anymore