-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix crashes when vkAllocateMemory fails #5754
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5754 +/- ##
==========================================
- Coverage 93.29% 93.28% -0.01%
==========================================
Files 845 845
Lines 265560 265757 +197
==========================================
+ Hits 247743 247905 +162
- Misses 17817 17852 +35 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
|
The binary size change of libncnn.so (bytes)
|
There was a problem hiding this 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 pull request fixes crashes that occur when Vulkan memory allocation fails due to insufficient VRAM by adding proper error handling and cleanup.
- Adds null checks after all
allocate_memoryandallocate_dedicated_memorycalls - Ensures proper resource cleanup (Vulkan object destruction and memory deallocation) on allocation failure
- Prevents crashes by returning null instead of proceeding with invalid memory
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for your contribution ! |
When system doesn't have enough VRAM, vkAllocateMemory fails and my app crashes. This patch fixes this by always checking return value of allocate_memory and allocate_dedicated_memory so my app can properly report error instead of crashing.