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

Memory Leak #220

Open
dcRolls opened this issue Jan 27, 2021 · 1 comment
Open

Memory Leak #220

dcRolls opened this issue Jan 27, 2021 · 1 comment

Comments

@dcRolls
Copy link

dcRolls commented Jan 27, 2021

This is a great tool. I've found, however, that the code appears to leak memory. I understand that it consumes memory to track the function calls, but when I limit scope by putting braces around a block of code which uses mocking, I still end up with an increase in memory, the size of which depends on the number of methods you are mocking. This is true even if I never actually call those methods.

`//Record initial memory footprint here:

     { //limit scope
        std::vector<IMySolid*> myObjs;
        Mock<IMySolid> mock;
        Method(mock, getShapeCount) = 1;
        Method(mock, getShapeCategory) = 1;
        myObjs.push_back(&mock.get());
                    
        for (std::vector<IMySolid*>::const_iterator it = myObjs.begin(); it != myObjs.end(); it++)
        {
           ;//don't actually call either mocked method             
        }
     } //end of scope 

//record new memory footprint here... this leads to an increase in memory of 119 bytes, when the same
code executed with the real solid results in no memory increase.`

Am I doing something wrong, or is there a memory leak?

Thanks.

@FranckRJ
Copy link
Collaborator

FranckRJ commented Aug 2, 2022

Looks like the mocks are never deleted for instance (at least I didn't find where they were by looking at the source code).

So there's at least that, but there can be more, I need to investigate further.

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

2 participants