Skip to content
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

C backend: workaround bulk freeing of constants #718

Merged
merged 1 commit into from
Oct 31, 2024
Merged

Conversation

AltGr
Copy link
Contributor

@AltGr AltGr commented Oct 10, 2024

Constants may need initialisation and allocations, which we do lazily, but that
doesn't combine well with the way our allocator works, freeing everything in
bulk.

This patch adds a switch to the allocator that make it use raw malloc, which
is turned on within the initialisation functions of constants.

@AltGr AltGr marked this pull request as draft October 10, 2024 12:23
@AltGr
Copy link
Contributor Author

AltGr commented Oct 10, 2024

(note: this is broken as it is, the catala allocator restoration command is inserted after return)

Constants may need initialisation and allocations, which we do lazily, but that
doesn't combine well with the way our allocator works, freeing everything in
bulk.

This patch adds a switch to the allocator that make it use raw `malloc`, which
is turned on within the initialisation functions of constants. A cleaner
solution will be to let Catala proceed normally but do a copy to persistent
memory afterwards; we'll need to implement this copy anyway for consumers to
more easily recover results from calls to catala.
@AltGr AltGr marked this pull request as ready for review October 29, 2024 16:37
@AltGr
Copy link
Contributor Author

AltGr commented Oct 29, 2024

Once we have functions to promote values allocated within the catala heap to persistent memory, these should be leveraged instead.

@AltGr AltGr merged commit 5d0359f into master Oct 31, 2024
5 checks passed
@AltGr AltGr deleted the nofreeconst branch October 31, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant