Skip to content

tool/ex/tests: consistently free ctx, then model#18168

Merged
JohannesGaessler merged 1 commit intoggml-org:masterfrom
JohannesGaessler:llama-free-order
Dec 22, 2025
Merged

tool/ex/tests: consistently free ctx, then model#18168
JohannesGaessler merged 1 commit intoggml-org:masterfrom
JohannesGaessler:llama-free-order

Conversation

@JohannesGaessler
Copy link
Contributor

Follow-up to #16653 .

This PR re-enables the check in the destructor w.r.t. the memory use, the problem was use-after-free if the model is freed before the context. For common this is unproblematic because the order of freeing is already correct. I also went through all manual uses of llama_init_from_model and checked whether things are freed in the correct order when the program terminates.

@github-actions github-actions bot added testing Everything test related examples labels Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants