Skip to content

Memory management - #227

Merged
drobnyjt merged 3 commits into
devfrom
memory_management
Nov 17, 2023
Merged

Memory management#227
drobnyjt merged 3 commits into
devfrom
memory_management

Conversation

@drobnyjt

Copy link
Copy Markdown
Collaborator

Thank you for your contribution to rustBCA!

Before submitting this PR, please make sure you have:

  • Opened an issue
  • Referenced the relevant issue number(s) below
  • Provided a description of the changes below
  • Ensured all tests pass and added any necessary tests for new code

Fixes #226

Description

It turns out that even if Rust forgets a raw pointer, it cannot be safely freed once C takes ownership. This PR adds a couple of cleanup functions that correctly dispose of structs with raw pointers when coupling to C to prevent memory leaking.

Tests

cargo test passes and RustBCA.c was used with valgrind to show that this fixes the leak. See the linked issue above.

@drobnyjt
drobnyjt merged commit 0b5ff72 into dev Nov 17, 2023
@drobnyjt
drobnyjt deleted the memory_management branch February 13, 2024 17:48
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.

1 participant