Giter Club home page Giter Club logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024

Original comment by [email protected] on 11 Nov 2008 at 6:47

  • Added labels: OpSys-All, Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

from googletest.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
We considered the following approaches:

1. let RUN_ALL_TESTS() cleans up all gtest data structures before it returns.
2. provide a CleanGoogleTest() function the user can call after RUN_ALL_TESTS().

#1 is less work for new users, but will break many existing users who call 
RUN_ALL_TESTS() more than once for various reasons.

#2 means the UnitTest object needs to be allocated on the heap.  This might 
break 
some existing users who already use a leak checker that ignores static global 
objects 
but not heap-allocated objects.

We need to think more about this.

Original comment by [email protected] on 2 Dec 2008 at 5:31

  • Changed state: Accepted

from googletest.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024

Original comment by [email protected] on 6 Mar 2010 at 6:05

  • Changed state: WontFix

from googletest.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
Reopening per user request.

I think a safe way to introduce the change is to keep the existing
behavior of RUN_ALL_TESTS() unchanged, and add a new function
testing::RunAllTestsAndBeDone() to run the tests *and* delete the
UnitTest singleton.  People caring about space leak checking can call
this new function instead of RUN_ALL_TESTS().

Original comment by [email protected] on 24 Mar 2010 at 9:55

  • Changed state: Accepted
  • Added labels: Priority-Medium
  • Removed labels: Priority-Low

from googletest.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024

A problem you should be aware of. 

I changed gtest.cc to delete the impl_ static object at end of job so I could 
use a
leak finder. It worked great, except when a death test was used. The leak 
finder was
called for every EXPECT_EXIT. And since the program terminated without the usual
exits to the functions, it showed leaks for all strings and other STL objects 
that
had been used. It is usually not practical to go thru all the normal exits when 
a
program is abnormally terminated. Also, there cannot be any outstanding 
allocated
memory or global variables in the test program, or they will also be reported as
leaks at this point.

The only way I found around it was to bypass the EXPECT_EXIT tests with a
preprocessor directive when the leak detector was used. This way, when the 
program
exited with the normal end of job, all leaks disappeared.

Even with this problem I think it is worth it to make this change. All required
changes to bypass the leak detector will be  in the test program. Making 
changes to
gtest itself is not necessary. Also the death tests are for exceptions that 
should
rarely, if ever, occur in normal processing. They can be tested when running 
without
the leak detector.

Original comment by [email protected] on 9 Apr 2010 at 8:24

from googletest.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
There is also global strings (in testing::flags) that cause hassle for leak 
detectors. 
They're allocated pre-main, and modified by GTestFlagSaver during the execution 
of 
tests.

This makes gtest impractical to use with standard Windows SDK crtdbg.h leak 
tracking, 
which is unfortunate.

Original comment by sgraham on 3 May 2010 at 8:07

from googletest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.