Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,16 @@ struct ggml_context * ggml_init(struct ggml_init_params params) {
/*.scratch_save =*/ { 0, 0, NULL, },
};

if (ctx->mem_buffer == NULL) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a GGML_ASSERT macro which can be used.

fprintf(stderr, "%s: failed to allocate memory buffer of size %zu\n", __func__, params.mem_size);

GGML_PRINT_DEBUG("%s: failed to allocate memory buffer\n", __func__);

ggml_critical_section_end();

return NULL;
}

ggml_assert_aligned(ctx->mem_buffer);

GGML_PRINT_DEBUG("%s: context initialized\n", __func__);
Expand Down