Skip to content

Commit 0639ff1

Browse files
committed
free batch before return
1 parent 6a9769a commit 0639ff1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

examples/imatrix/imatrix.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ static bool compute_imatrix(llama_context * ctx, const common_params & params) {
518518

519519
if (llama_decode(ctx, batch)) {
520520
LOG_ERR("%s : failed to eval\n", __func__);
521+
llama_batch_free(batch);
521522
return false;
522523
}
523524

examples/perplexity/perplexity.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ static results_perplexity perplexity_v2(llama_context * ctx, const common_params
423423
//LOG_DBG(" Batch %d: starts at %d, size is %d, n_past is %d\n",j,batch_start,batch_size,j * n_batch);
424424
if (llama_decode(ctx, batch)) {
425425
//LOG_ERR("%s : failed to eval\n", __func__);
426+
llama_batch_free(batch);
426427
return {tokens, -1, logit_history, prob_history};
427428
}
428429

@@ -1821,6 +1822,7 @@ static void kl_divergence(llama_context * ctx, const common_params & params) {
18211822

18221823
if (llama_decode(ctx, batch)) {
18231824
LOG_ERR("%s : failed to eval\n", __func__);
1825+
llama_batch_free(batch);
18241826
return;
18251827
}
18261828

0 commit comments

Comments
 (0)