fix(shader): replace raw new[] with std::vector in arbiter_t#340
Open
eunseo9311 wants to merge 1 commit intogpgpu-sim:devfrom
Open
fix(shader): replace raw new[] with std::vector in arbiter_t#340eunseo9311 wants to merge 1 commit intogpgpu-sim:devfrom
eunseo9311 wants to merge 1 commit intogpgpu-sim:devfrom
Conversation
arbiter_t::init() allocated 6 arrays with new/new[] but the class had no destructor, leaking all of them for the lifetime of the simulation. One arbiter_t exists per operand collector unit per SM, so the leak scales with GPU config size. Replace all raw pointer members with std::vector (including the 2D int** _request → vector<vector<int>>). This eliminates the leak via automatic RAII destruction and removes the need for a manual destructor entirely. No functional change — all access patterns (operator[]) remain identical.
This file contains hidden or 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
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.
Summary
new[]allocations inarbiter_twithstd::vector, fixing a memory leak caused by missing destructorarbiter_texists per operand collector unit per SM, so the leak scales with GPU config sizeProblem
arbiter_t::init()allocated arrays withnew/new[]but the class had no destructor:All 6 allocations leaked for the entire simulation lifetime.
Fix
Replace raw pointer members with
std::vector:init()usesresize()instead ofnew[]. RAII handles cleanup — no manual destructor needed.Impact
operator[]access patterns remain identicalTest plan
source setup_environment release && make -j