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

Minor memory leaks #37

Open
sanguinariojoe opened this issue Nov 18, 2018 · 0 comments
Open

Minor memory leaks #37

sanguinariojoe opened this issue Nov 18, 2018 · 0 comments

Comments

@sanguinariojoe
Copy link

sanguinariojoe commented Nov 18, 2018

In main.cc you are dynamically building the networkManager entity:

gdata.networkManager = new NetworkManager();

However, you are not checking if the memory has been correctly allocated (IDEM for the problem), and there are some exit conditions where the object is not removed:

	if (nm_worldsize > MAX_NODES_PER_CLUSTER) {
		cerr << "Too many nodes in cluster: " << nm_worldsize << " > " << MAX_NODES_PER_CLUSTER << endl;
		exit(1);
	}
(...)
		if (!gdata.clOptions->gpudirect) {
			// since H2D and D2H transfers have to wait for network transfers
			fprintf(stderr, "FATAL: asynchronous network transfers require --gpudirect\n");
			gdata.networkManager->finalizeNetwork();
			return 1;
		}

		if (gdata.devices > 1) {
			// since we were too lazy to implement a more complex mechanism
			fprintf(stderr, "FATAL: asynchronous network transfers only supported with 1 process per device\n");
			gdata.networkManager->finalizeNetwork();
			return 1;
		}

In NetworkManager.cc:70, you are in-place reallocating memory. If such operation fails, then the memory in m_requestsList is not realeased, and the pointer is nullified.

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

1 participant