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

Smart Pointers use #234

Closed
ZigRazor opened this issue Oct 10, 2022 · 7 comments · Fixed by #316
Closed

Smart Pointers use #234

ZigRazor opened this issue Oct 10, 2022 · 7 comments · Fixed by #316
Assignees
Labels
core something about core enhancement New feature or request good first issue Good for newcomers hacktoberfest hacktoberfest issue help wanted Extra attention is needed Priority:Medium Priority Label for medium priority issue

Comments

@ZigRazor
Copy link
Owner

why don't use smart pointers?
I think is better to introduce and use smart pointers in all code

@ZigRazor ZigRazor added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers core something about core Priority:Medium Priority Label for medium priority issue hacktoberfest hacktoberfest issue labels Oct 10, 2022
@Soumyajit2825
Copy link

So what to do???
Adding some documentation about smart pointers or some code using examples??

@ZigRazor
Copy link
Owner Author

I think there is the need to rework the code to let all the pointers change in smart pointers

@suncanghuai
Copy link
Contributor

suncanghuai commented Oct 10, 2022

I think smart pointers have to be introduced as it's hard to manually free all dynamic allocated memory in a growing project. And by the way, may I ask a question here @ZigRazor ? I'm confused about dynamic allocated memory in part of benchmark-related code. I dont find some place in part of benchmark-related code where we free those dynamic allocated memory to which static variables(pointers) point, and each .cpp has a copy of them because each .cpp include utility.h once respectively. So it seems a huge memory leak problem exists?

`//Static Generation
static auto nodes = generateRandomNodes(100000, 2);

static auto edges = generateRandomEdges(100000, nodes);

static auto undirectedEdges = generateRandomUndirectedEdges(100000, nodes);

static auto cit_graph_ptr = readGraph("CitHepPh");`

@ZigRazor
Copy link
Owner Author

hi @suncanghuai good annotations,

I think is the moment to do this, before the stable release.

In benchmark related code, the dynamic allocated memory is free only when the program is terminated. But is allocated only one time because the variable is static and the include file is protected by an #ifndef condition.

So the memory is allocated by the first one that use it and then never released inside the execution, but only when the executable terminates, this because these variables are used in different point of the code.

@ZigRazor ZigRazor pinned this issue Mar 1, 2023
@sbaldu
Copy link
Collaborator

sbaldu commented May 12, 2023

Hi @ZigRazor, can you assign me this issue if it's still available, please?

@ZigRazor
Copy link
Owner Author

Yes, I assign it to you @sbaldu !

@ZigRazor
Copy link
Owner Author

ZigRazor commented Jun 1, 2023

Closed by PR #316

@ZigRazor ZigRazor closed this as completed Jun 1, 2023
@ZigRazor ZigRazor unpinned this issue Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core something about core enhancement New feature or request good first issue Good for newcomers hacktoberfest hacktoberfest issue help wanted Extra attention is needed Priority:Medium Priority Label for medium priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants