Skip to content

remove unnecessary lock in SharedMemoryResource::do_deallocate#108

Open
ShoroukRamzy wants to merge 1 commit intoeclipse-score:mainfrom
Valeo-S-CORE-Organization:remove-unneeded-deallocate-lock
Open

remove unnecessary lock in SharedMemoryResource::do_deallocate#108
ShoroukRamzy wants to merge 1 commit intoeclipse-score:mainfrom
Valeo-S-CORE-Organization:remove-unneeded-deallocate-lock

Conversation

@ShoroukRamzy
Copy link
Contributor

Summary

This PR removes an unnecessary std::lock_guard from the SharedMemoryResource::do_deallocate method.

Problem

The SharedMemoryResource implements a monotonic (Arena) allocation strategy, where deallocate is a no-op. The current implementation acquires a heavyweight InterprocessMutex before doing nothing, which introduces unnecessary performance overhead on every deallocation call.

Solution

The std::lock_guard is removed from the function. Since no shared state is read or modified, no lock is required.

Benefits

  • Performance: Eliminates a costly and unnecessary system call, making deallocation a true zero-cost operation as expected from a monotonic allocator.
  • Clarity: The code now more accurately reflects the no-op nature of the function.

@github-actions
Copy link

The created documentation from the pull request is available at: docu-html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant