Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export some api to free the image memory #234

Open
chinshou opened this issue Apr 22, 2024 · 1 comment
Open

export some api to free the image memory #234

chinshou opened this issue Apr 22, 2024 · 1 comment

Comments

@chinshou
Copy link

            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.

@FSSRepo
Copy link
Contributor

FSSRepo commented Apr 25, 2024

I understand, for now the project is a mishmash of things, it still doesn't have a specific format to follow, the latest refactorings have made the code very verbose and difficult to understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants