Skip to content
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 memory leaks in Debugger #1411

Merged
merged 1 commit into from
Jan 17, 2025
Merged

Fix memory leaks in Debugger #1411

merged 1 commit into from
Jan 17, 2025

Conversation

clover2123
Copy link
Contributor

  • shared structure BreakpointLocationsInfo between debuggger and ByteCodeBlock can cause memory leaks
  • correctly delete each BreakpointLocationsInfo

@clover2123
Copy link
Contributor Author

The main cause of this memory leak is correlation between GC-Object and Non-GC-Object

ByteCodeBlock : GC-Object
Debugger::BreakpointLocationsInfo : Non-GC-Object

Debugger::BreakpointLocationsInfo should be properly deleted.

void clearParsingData()
{
m_breakpointLocationsVector.clear();
}

At here, m_breakpointLocationsVector vector has addresses of Debugger::BreakpointLocationsInfo, but only these addresses are cleared instead of deleting each Debugger::BreakpointLocationsInfo

Comment on lines +1855 to +1861
void DebuggerC::deleteClient()
{
if (m_debuggerClient) {
// delete DebuggerClient that was created and delivered from the user
delete m_debuggerClient;
m_debuggerClient = nullptr;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_debuggerClient is a non-GC-object created by the user, so it should be deleted as well

@clover2123
Copy link
Contributor Author

@zherczeg
I found this memory leak by chance.
Would you please review this patch?

Copy link
Contributor

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for fixing this.

@clover2123
Copy link
Contributor Author

@zherczeg thanks for the quick review!

@clover2123 clover2123 marked this pull request as ready for review January 16, 2025 08:16
* shared structure `BreakpointLocationsInfo` between debuggger and ByteCodeBlock can cause memory leaks
* correctly delete each `BreakpointLocationsInfo`

Signed-off-by: HyukWoo Park <[email protected]>
@ksh8281 ksh8281 merged commit a57df75 into Samsung:master Jan 17, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants