Skip to content

Conversation

@xal-0
Copy link
Member

@xal-0 xal-0 commented Oct 7, 2025

Handle a failed allocation in jl_image_unpack_zstd better:

  • On Windows, if GetLargePageMinimum() reports that large pages are unsupported, don't try to allocate with MEM_LARGE_PAGES.
  • If they are supported but the large page allocation fails, try again without the option.
  • On all platforms, provide a better error message when the allocation fails.

Ported from #59340.

Copy link
Member

@topolarity topolarity left a comment

Choose a reason for hiding this comment

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

Thanks!

if (fail) {
const char *err;
#if defined(_OS_WINDOWS_)
char err_buf[256];
Copy link
Member

Choose a reason for hiding this comment

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

256 bytes seems a bit conservative - maybe double it?

Also looking at the implementation of win32_formatmessage, it looks like it leaves err_buf mostly uninitialized if the buffer is too small. That could probably do with a quick fix-up.

Copy link
Member Author

Choose a reason for hiding this comment

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

GitHub just showed me the approval but not any of the review comments. Woops. I'll have to do this in another PR but I expect to have to touch this code soon anyway.

@xal-0 xal-0 merged commit 03f031a into JuliaLang:master Oct 8, 2025
8 checks passed
gbaraldi pushed a commit that referenced this pull request Oct 9, 2025
…59773)

Handle a failed allocation in `jl_image_unpack_zstd` better:
- On Windows, if `GetLargePageMinimum()` reports that large pages are
unsupported, don't try to allocate with `MEM_LARGE_PAGES`.
- If they are supported but the large page allocation fails, try again
without the option.
- On all platforms, provide a better error message when the allocation
fails.

Ported from #59340.
gbaraldi pushed a commit that referenced this pull request Oct 9, 2025
…59773)

Handle a failed allocation in `jl_image_unpack_zstd` better:
- On Windows, if `GetLargePageMinimum()` reports that large pages are
unsupported, don't try to allocate with `MEM_LARGE_PAGES`.
- If they are supported but the large page allocation fails, try again
without the option.
- On all platforms, provide a better error message when the allocation
fails.

Ported from #59340.
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