Skip to content

Partial fix to DOSBox-X Mem leak#4715

Closed
SergioMartin86 wants to merge 7 commits intomasterfrom
dosbox-memleak-fix
Closed

Partial fix to DOSBox-X Mem leak#4715
SergioMartin86 wants to merge 7 commits intomasterfrom
dosbox-memleak-fix

Conversation

@SergioMartin86
Copy link
Copy Markdown
Collaborator

This PR adds some measures to reduce leakage on the DOSBox-X core, as described in #4714

  • Timely deload of read only HDD files right after init (no longer needed)
  • Freeing of the RW HDD file buffer upon closure (added deInit() function)

There's one more leak remaining we'll need to find eventually. Not sure it's DosBox or Bizhawk related

@SergioMartin86 SergioMartin86 self-assigned this Apr 26, 2026
@SergioMartin86 SergioMartin86 added the Core: DOSBox-X MS-DOS/Win9x and PC-98 core label Apr 26, 2026
@SergioMartin86
Copy link
Copy Markdown
Collaborator Author

This fix is ready for merge, btw

}

// Freeing up core's own resources
_libDOSBox.deInit();
Copy link
Copy Markdown
Member

@CasualPokePlayer CasualPokePlayer Apr 26, 2026

Choose a reason for hiding this comment

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

This is pointless in practice. Any memory allocated within the waterbox should be destroyed by the waterboxhost. You're not allocating with a normal heap, you're allocating within the waterboxhost's memory block, which by the view of the host OS is already allocated fully by the waterboxhost and should be released by the waterboxhost. There's nothing in the core code to do here (the OS won't recognize free'ing in core code as actually freeing the memory, the memory is still allocated by the waterboxhost).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Right, I forgot about this

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

Labels

Core: DOSBox-X MS-DOS/Win9x and PC-98 core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants