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

Freeing memory #9

Closed
markrbower opened this issue Jul 20, 2023 · 1 comment
Closed

Freeing memory #9

markrbower opened this issue Jul 20, 2023 · 1 comment

Comments

@markrbower
Copy link

From the example:

                Graph graph(&sg);
                CPMVertexPartition part(&graph, 0.05 /* resolution */ );
                Optimiser o;
                o.optimise_partition(&part);

How can all of these objects (graph, parth, o) be deleted? I see destructors for them in the source code, but cannot find the correct syntax for calling them.

@vtraag
Copy link
Owner

vtraag commented Jul 21, 2023

These objects are never deleted explicitly, they are simply destroyed automatically when they go out of scope. You never call destructors manually. See https://stackoverflow.com/questions/10157122/object-creation-on-the-stack-heap for more detail.

However, I did note that I forgot to destroy an igraph_t object in the example.cpp, this is now corrected in abc2fbc.

@vtraag vtraag closed this as completed Jul 21, 2023
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