Skip to content

size_t for all alloc functions - #1388

Merged
Aidan63 merged 3 commits into
HaxeFoundation:masterfrom
Aidan63:sizet_alloc_funcs
Sep 5, 2026
Merged

size_t for all alloc functions#1388
Aidan63 merged 3 commits into
HaxeFoundation:masterfrom
Aidan63:sizet_alloc_funcs

Conversation

@Aidan63

@Aidan63 Aidan63 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Like my previous PR, but for the alloc functions. All these functions now compile with those clang pragma and size_t is used in place of int.
One thing I did notice here is that very, very, big allocs will not have a correct size in the object header. 32bits are used in the GC header for a large objects size, so if you allocate an object created than std::numeric_limits<unsigned int>::max() it will get an invalid size (line 3300). I don't know if anyone has tried to allocate an object this large, but maybe we should add a check and raise a hxcpp critical error in these cases.

Comment thread src/hx/gc/Immix.cpp Outdated
bool do_lock{ true };
#else
bool do_lock = false;
bool do_lock{};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think an explicit false here makes more sense if this value will have an effect

@Aidan63
Aidan63 merged commit 952b6ac into HaxeFoundation:master Sep 5, 2026
145 checks passed
@Aidan63
Aidan63 deleted the sizet_alloc_funcs branch September 5, 2026 09:18
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