Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kimerafusion

Pages: [1]
1
General / Re: Memory leak
« on: August 22, 2014, 12:36:27 am »
Oh thanks a lot, that's why. Yeah, probably something I did not understand properly while learning C++.

2
General / Memory leak
« on: August 22, 2014, 12:12:09 am »
Hey there, got a problem in some code, I saw that I had a mem leak (using Task Manager), and when I started looking everywhere by commenting 99% of my code I saw that the mem leak was supposed to be in this part of code :
void RectGrid::DrawGrid(sf::RenderWindow *window) {
        sf::Sprite RectSprite = *new sf::Sprite();
        RectSprite.setTexture(*RectTexture);
        for (int x = 0; x < grid.size(); x++) {
                for (int y = 0; y < grid.at(x).size(); y++) {
                        window->draw(RectSprite);
                }
        }
}
RectTexture is nothing more than an sf::Texture* and grid is an std::vector<std::vector<RectType>> where RectTypeis an enum. window is a pointer on an sf::RenderWindow.
I really don't understand what I have done wrong in this code...

Pages: [1]
anything