-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[Bug]: MSVC - Assertion macro SUCCEED() leeds to a memory leak. #4569
Comments
I haven't tried this, so I could be wrong, but I think this is probably working as intended. It looks like under the hood, the Now we could change If you really want to use |
By the way, you can test my hypothesis by simply using an additional set of braces around the body of the test:
|
@derekmauro Sorry for the delay, I was out of the office for a few days. Unfortunately, your suggestion does not bring any improvement. I would have been surprised too, because in my real project the memory leak check is handled in a separate TestEventListener. So the binding scope of SUCCEED() is already finished when the memory check is called. I have simplified the call structure somewhat just for this issue description. |
Describe the issue
To secure my C++ applications under MSVC (V17.10.3), I like to use the functions of the extension "CRT debug heap" from Microsoft. I want to ensure that my software does not leave any memory fragments on the heap. My tests therefore checks whether the heap state is identical before and after a test case.
In most cases, this works very well. However, if I use the assertion macro SUCCEED(), a memory leak is reported.
Steps to reproduce the problem
Use the following test case:
The test ends successfully as long as I use the assertion
EXPECT_TRUE(true)
(marker(1)
).As soon as I use the macro
SUCCEED()
(marker(2)
), a memory leak is reported at the end.What version of GoogleTest are you using?
GoogleTest v1.14.0
commit f8d7d77
What operating system and version are you using?
Microsoft Windows 11
Version 23H2 (Build 22631.3447)
What compiler and version are you using?
Microsoft Visual Studio Professional 2022 (64-bit)
Current Version 17.10.3
What build system are you using?
msbuild --version
MSBuild-Version 17.10.4+10fbfbf2e für .NET Framework
17.10.4.21802
Additional context
No response
The text was updated successfully, but these errors were encountered: