Skip to content

Conversation

@2010YOUY01
Copy link
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

Add more docs to the structures related to MemoryPool

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the execution Related to the execution crate label Jun 6, 2025
/// ╚═══════════════════════════════════════════════════╝
///
/// For example, there are two parallel partitions of an operator X: each partition
/// corresponds to a `MemoryConsumer` in the above diagram. Inside operator X there are
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @2010YOUY01

Can we clarify slightly more on Inside operator X there are several MemoryReservations for different internal data structures. I read it twice, not sure what does that mean 🤔 is it MemoryReservation per data structure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

Yes, and I updated it to be more explicit. I suspect now most MemoryConsumers only use 1 reservation for aggregated memory accounting, but by design a consumer can use multiple reservations for finer-grained stat report and also make implementation cleaner.

@2010YOUY01
Copy link
Contributor Author

@ding-young Could you take a look and point out anything that doesn't make sense to help refine the doc?

Comment on lines 119 to 120
/// - `MemoryReservation` follows RAII principles - to release a reservation,
/// simply drop the corresponding `MemoryReservation` object
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is good for explaining that MemoryReservation uses RAII-style dropping, but it might be clearer if we also mention that it is automatically unregistered from the memory pool via SharedRegistration. That way, it’s easier to understand the role of SharedRegistration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks!

@alamb alamb added the documentation Improvements or additions to documentation label Jun 9, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

This is a really nice improvement - thank you @2010YOUY01 @ding-young and @comphead

@2010YOUY01 2010YOUY01 merged commit 3a312a9 into apache:main Jun 11, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation execution Related to the execution crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants