stable-diffusion.cpp
stable-diffusion.cpp copied to clipboard
export some api to free the image memory
for (int i = 0; i < params.video_frames; i++) {
if (results[i].data == NULL) {
continue;
}
std::string final_image_path = i > 0 ? dummy_name + "_" + std::to_string(i + 1) + ".png" : dummy_name + ".png";
stbi_write_png(final_image_path.c_str(), results[i].width, results[i].height, results[i].channel,
results[i].data, 0, get_image_params(params, params.seed + i).c_str());
printf("save result image to '%s'\n", final_image_path.c_str());
free(results[i].data);
results[i].data = NULL;
}
free(results);
it looks like library use standard c free function to free the memory of the image. But there is no api exported to free the image memory. For 3rd language such as pascal, it is not convenient to call standard C to free the resource.