]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
llama : fix memory leak in llama_batch_free (#5252)
authorIan Bull <redacted>
Fri, 2 Feb 2024 07:20:13 +0000 (23:20 -0800)
committerGitHub <redacted>
Fri, 2 Feb 2024 07:20:13 +0000 (09:20 +0200)
commite1e721094d8169636d55f68efe37f222cd3f0677
tree9ba25970ab3932a892cc706b9d5c888749d90a7e
parent128dcbd3c9c4b12f42b560a4430427d7b2828628
llama : fix memory leak in llama_batch_free (#5252)

The llama_batch_init allocates memory for a fixed number of tokens.
However, the llama_batch_free only frees memory for the number of
tokens that were added to the batch.

This change-set uses a null terminated array for the batch seq_id, and
frees all the elements until the nullptr is reached. This change-set
also changes the name of the first parameter from `n_tokens` to
`n_tokens_alloc` to more clearly indicate that this value is the number
of tokens allocated to the batch, not the number of tokens in the batch.
llama.cpp