Skip to content

Bug: image encoding error with malloc memory #10225

@dingtine

Description

@dingtine

What happened?

When compiling the Minicpm model, during the process of image encoding, memory allocation operations are performed for the variables.
The first subgraph execution runs fine, but during the second malloc, it reports a core dump error. I have not been able to identify the cause. Please help me.

code file: llava.cpp
code: image_embd_v[i] = (float *)malloc(clip_embd_nbytes(ctx_clip)); ##clip_embd_nbytes(ctx_clip):917504

if (clip_is_minicpmv(ctx_clip)) {
std::vector<float *> image_embd_v;
image_embd_v.resize(img_res_v.size);
struct clip_image_size * load_image_size = clip_image_size_init();
for (size_t i = 0; i < img_res_v.size; i++) {
const int64_t t_img_enc_step_start_us = ggml_time_us();
image_embd_v[i] = (float *)malloc(clip_embd_nbytes(ctx_clip));
int patch_size=14;
load_image_size->width = img_res_v.data[i].nx;
load_image_size->height = img_res_v.data[i].ny;
clip_add_load_image_size(ctx_clip, load_image_size);
bool encoded = false;

Name and Version

./llama-llava-cli latest linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-unconfirmedlow severityUsed to report low severity bugs in llama.cpp (e.g. cosmetic issues, non critical UI glitches)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions