Skip to content

Conversation

@Radvendii
Copy link
Contributor

Motivation

EvalMemory::allocBytes() allows us to easily change how memory is allocated throughout the program. I have been using it to put all allocations in a bump allocator so I can more easily track memory leaks.

One problem is that this has to change the c bindings. I don't know how much of an issue this is as I haven't worked on the c bindings much until now.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Radvendii Radvendii requested a review from edolstra as a code owner November 17, 2025 21:07
@github-actions github-actions bot added new-cli Relating to the "nix" command c api Nix as a C library with a stable interface labels Nov 17, 2025
@Radvendii Radvendii force-pushed the allocbytes-stringdata branch from 403b9af to 26fa5af Compare November 17, 2025 21:25
Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

Looks good, just should update the C API first and let Robert know.

As far as I can tell, this is an unavoidable breaking change of the C API.

CC @roberth

@Radvendii
Copy link
Contributor Author

To expand on what @Ericson2314 said, we discussed it in the meeting and we can anticipate that a similar change will be necessary for all the c api functions that create Values (eventually, when values themselves are stored in managed memory), so we should make those changes all now, and split it off into a separate PR. I'll try to get to that later this week.

Radvendii added a commit to Radvendii/nix that referenced this pull request Nov 19, 2025
We will need this argument in the future as we put things in managed
memory. see NixOS#14584 for an example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c api Nix as a C library with a stable interface new-cli Relating to the "nix" command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants