Skip to content

Commit e458896

Browse files
minor: more informative error message for buffer overflow (#1357)
<!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues #1353 ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [ ] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [ ] I have installed the hooks with `pre-commit install`. - [ ] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. --> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 2fe5331 commit e458896

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/flashinfer/allocator.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ struct AlignedAllocator {
4343
return result;
4444
} else {
4545
std::ostringstream oss;
46-
oss << "Failed to allocate memory for " << name << " with size " << size << " and alignment "
47-
<< alignment << " in AlignedAllocator";
46+
oss << "Buffer overflow when allocating memory for " << name << " with size " << size
47+
<< " and alignment " << alignment << ", but only " << remaining_space
48+
<< " bytes available in AlignedAllocator. Increase the workspace buffer size.";
4849
FLASHINFER_ERROR(oss.str());
4950
}
5051
return nullptr;

0 commit comments

Comments
 (0)