Skip to content

How to bind huge classes #759

Closed Answered by wjakob
ghorn asked this question in Q&A
Oct 11, 2024 · 4 comments · 12 replies
Discussion options

You must be logged in to vote

The static_assert is needed. The information that nanobind stores about the type is fairly compressed, and only 24 bits are available to encode the size. You will have undefined behavior if nanobind ever tries to allocate such a class on its own (instead of allocating one in C++ and then returning it to Python), as it will not acquire enough memory for it.

Replies: 4 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@ghorn
Comment options

Comment options

You must be logged in to vote
6 replies
@wjakob
Comment options

Answer selected by ghorn
@ghorn
Comment options

@wjakob
Comment options

@wjakob
Comment options

@ghorn
Comment options

Comment options

You must be logged in to vote
3 replies
@wojdyr
Comment options

@ghorn
Comment options

@ghorn
Comment options

Comment options

You must be logged in to vote
2 replies
@wojdyr
Comment options

@wjakob
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants