We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0d96efa commit b5554b9Copy full SHA for b5554b9
common/sampling.cpp
@@ -1,8 +1,7 @@
1
#include "sampling.h"
2
3
struct llama_sampling_context * llama_sampling_init(const struct gpt_params & params) {
4
- struct llama_sampling_context * result =
5
- (struct llama_sampling_context *) malloc(sizeof(struct llama_sampling_context));
+ struct llama_sampling_context * result = new llama_sampling_context();
6
7
result->params = params.sampling_params;
8
result->grammar = nullptr;
@@ -34,7 +33,7 @@ void llama_sampling_free(struct llama_sampling_context * ctx) {
34
33
llama_grammar_free(ctx->grammar);
35
}
36
37
- free(ctx);
+ delete ctx;
38
39
40
void llama_sampling_reset(llama_sampling_context * ctx) {
0 commit comments