Skip to content

Conversation

@JesusRojass
Copy link
Contributor

@JesusRojass JesusRojass commented Dec 11, 2025

This fix consists of using task_info rather than mstats which is a more modern way to measure memory usage, task_info should do a memory query that does not touch the allocator's internal state

This should fix issue #15501

Testing

  • All unit tests working as expected

API Changes

  • No API Changes

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@JesusRojass JesusRojass marked this pull request as ready for review December 17, 2025 01:42
@JesusRojass
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a race condition by replacing mstats() with the more modern task_info() for memory metric collection, which is a great improvement for stability. My review focuses on improving the clarity and maintainability of the new implementation. I've suggested removing a now-redundant variable and a block of dead code. I also noted that the collected memory metric has changed semantically from heap usage to physical memory footprint, and recommended updating internal data structures and comments to reflect this to avoid future confusion. Overall, these changes are positive, and addressing the feedback will further enhance the code quality.

@JesusRojass
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a race condition in memory metric collection by replacing the usage of mstats with the more modern and thread-safe task_info API. This is a solid improvement for stability. The implementation correctly uses task_info to get the physical memory footprint. My review includes a suggestion to improve error logging and raises a point about the naming of the collected metric, which has semantically changed from heap usage to physical memory footprint, potentially causing confusion.

…tor.m

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@JesusRojass JesusRojass changed the title WIP!!! Fix race condition caused by mstats replacing it with task_info #15501 Fix race condition caused by mstats replacing it with task_info #15501 Dec 17, 2025
@JesusRojass
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses a race condition by replacing the mstats() call with the more modern and thread-safe task_info() for memory usage measurement. This is a great improvement for the stability of the SDK. The change from measuring heap usage to physical memory footprint is clearly communicated through updated comments, and the removal of the now-unavailable heapAvailable metric is handled correctly. The implementation is solid, and I have just one minor suggestion to further improve type safety.

…tor.m

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

2 participants