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

[C++] Memory leak 'validator_map' when exiting process #889

Open
xamix opened this issue Jun 9, 2023 · 0 comments
Open

[C++] Memory leak 'validator_map' when exiting process #889

xamix opened this issue Jun 9, 2023 · 0 comments
Labels
Bug Reports and/or fixes a bug C++ C++ language support

Comments

@xamix
Copy link

xamix commented Jun 9, 2023

Hi,

I'm running Valgrind on a project which use PGV.
The project do not allow any memory leaking even when exiting the program.

In your file validate.h you create a global validator_map on heap.

However this map is never destroyed leading to error in Valgrind complaining at exit of program that it leaked.

In protobuf they provide the ShutdownProtobufLibrary function in order to deallocate every allocated object and makes memory analyzer happy.

For now to temporarly FIX that, I have added the following similar function in BaseValidator in order to cleanup this map and make Valgrind happy with no error:

  static void ShutdownValidator() {
    delete &abstractValidators();
  }

I call this function when my program exit, at the same time of the ShutdownProtobufLibrary function.

Regards

@rodaine rodaine added Bug Reports and/or fixes a bug C++ C++ language support labels Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reports and/or fixes a bug C++ C++ language support
Projects
None yet
Development

No branches or pull requests

2 participants