Skip to content

Remove a dynamically created stackalloc#966

Merged
adamhathcock merged 4 commits intomasterfrom
adam/reduce-stackalloc
Oct 22, 2025
Merged

Remove a dynamically created stackalloc#966
adamhathcock merged 4 commits intomasterfrom
adam/reduce-stackalloc

Conversation

@adamhathcock
Copy link
Owner

Hopefully there's no more that will blow out the stack.

Fixes #965

Copy link
Contributor

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 replaces dynamically-sized stackalloc allocations with ArrayPool<byte> to prevent potential stack overflow issues. The changes address issue #965 by eliminating stack allocations whose size could vary based on input data.

Key Changes:

  • Removed unused DDecode and DBits stackalloc declarations in Unpack29 method
  • Replaced dynamic stackalloc byte[VMCodeSize] with ArrayPool<byte>.Shared.Rent() in AddVMCode method
  • Removed unused length parameter from AddVMCode method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@adamhathcock adamhathcock merged commit eda0309 into master Oct 22, 2025
2 checks passed
@adamhathcock adamhathcock deleted the adam/reduce-stackalloc branch October 22, 2025 09:13
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.

Stack Overflow due to large stack allocations

2 participants