Closed JohannesGaessler closed 2 hours ago
The graph and tensors do not have any references to the ggml_context
, they are allocated from the buf_compute_meta
which is stored in llama_context
.
Thanks, I was missing that the buffer for the graph + tensors is allocated externally.
In
llama_build_graph
:llm_build_context
is created.llm_build_context.init()
which in turn callsggml_init
and stores theggml_context
pointer asllm_build_context.ctx0
.llm_build_context.ctx0
.llm_build_context.free()
which in turn callsggml_free(llm_build_context.ctx0)
.Unless I'm missing something this is a use-after-free bug since the
ggml_context
that the graph (and its tensors) have been allocated in is always freed before returning the graph.