Skip to content

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #48955

…ce (#48955)

### What problem does this PR solve?

Problem Summary:
As this issue describes apache/hudi#12918
While debugging a memory leak issue, I noticed a steady increase in the
number of BitCaskDiskMap instances through jmap logs. Using VisualVM, I
found that a memory leak may exist in BitCaskDiskMap due to a circular
reference.

![image](https://github.com/user-attachments/assets/0af6fa66-4c61-46dc-9c67-df1ae18c6607)
- The cleanup method is an instance method that implicitly depends on
the this pointer
- When cleanup is called from shutdownThread, it holds a reference to
this
- Meanwhile, the DiskMap class holds a reference to shutdownThread

![image](https://github.com/user-attachments/assets/3a762e6d-4ebe-4177-a6ff-c01afa5b8180)

This creates a circular reference:
```text
  DiskMap (this) -> shutdownThread -> cleanup -> DiskMap (this)
```
@github-actions github-actions bot requested a review from yiguolei as a code owner March 16, 2025 09:11
@Thearas
Copy link
Contributor

Thearas commented Mar 16, 2025

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Mar 16, 2025
@Thearas
Copy link
Contributor

Thearas commented Mar 16, 2025

run buildall

@yiguolei yiguolei merged commit abc535a into branch-2.1 Mar 21, 2025
20 checks passed
@github-actions github-actions bot deleted the auto-pick-48955-branch-2.1 branch March 21, 2025 14:44
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.

5 participants