Skip to content

[SOL] Allocate less space on stack for drift sort #127

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

Merged
merged 1 commit into from
May 8, 2025

Conversation

LucasSte
Copy link
Collaborator

@LucasSte LucasSte commented May 6, 2025

Problem

When building a Solana contract with Rust 1.84.1, we face a stack overflow warning coming from drift sort, Rust's new default sorting algorithm. It allocates 4096 bytes on the stack to avoid heap allocations.

Solution

Allocate only 2048 bytes for SBPFv0.

@LucasSte LucasSte force-pushed the fix-error-msg branch 2 times, most recently from a6fd4cf to 0e666ae Compare May 7, 2025 13:55
@LucasSte LucasSte requested a review from Lichtso May 8, 2025 10:51
@LucasSte LucasSte marked this pull request as ready for review May 8, 2025 10:51
@LucasSte LucasSte merged commit 7d0f408 into anza-xyz:solana-1.84.1 May 8, 2025
11 checks passed
@LucasSte LucasSte deleted the fix-error-msg branch May 8, 2025 15:05
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