Skip to content

Smaller thread stack size for copy threads #12065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Erarndt
Copy link
Contributor

@Erarndt Erarndt commented Jun 24, 2025

Context

We spawn a handful of threads to handle synchronous copying. These threads don't need the default stack size, and we can specify a smaller one to save some space for resource constrained machines.

Changes Made

Testing

Notes

@Copilot Copilot AI review requested due to automatic review settings June 24, 2025 17:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reduces the stack size for threads used in synchronous copy operations to save memory on resource-constrained machines.

  • Adjusts thread creation by specifying a 64KB stack size.
  • Adds a comment explaining the rationale for the new stack size setting.

Thread newThread = new Thread(ParallelCopyTask);

// specify the smallest stack size - 64kb
Thread newThread = new Thread(ParallelCopyTask, 64 * 1024);
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider defining the stack size (64 * 1024) as a named constant to improve readability and ease future modifications.

Suggested change
Thread newThread = new Thread(ParallelCopyTask, 64 * 1024);
Thread newThread = new Thread(ParallelCopyTask, DefaultStackSize);

Copilot uses AI. Check for mistakes.

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