Hello, I read this http://msdn.microsoft.com/en-us/library/e5ewb1h3(v=vs.71).aspx (tells you how to detect memory leaks in VS) and I applied it to my project but I got some unexpected results. I am not even dynamically allocating anything and it tells me I have a bunch of memory leaks.
Detected memory leaks!
Dumping objects ->
{173} normal block at 0x038F9D90, 20 bytes long.
Data: <8.s 8.s 8.s > 38 2E 73 00 38 2E 73 00 38 2E 73 00 01 00 CD CD
{172} normal block at 0x038F3408, 24 bytes long.
Data: <@4 > 40 34 8F 03 FF FF FF FF 00 00 00 00 00 00 00 00
{171} normal block at 0x0360EEA0, 40 bytes long.
Data: < _ > D4 C5 C3 5F 18 00 00 00 08 00 00 00 00 00 00 00
{170} normal block at 0x0072BCF0, 40 bytes long.
Data: < _ > D4 C5 C3 5F 18 00 00 00 08 00 00 00 00 00 00 00
{151} normal block at 0x007335B0, 32 bytes long.
Data: <Platformer Studi> 50 6C 61 74 66 6F 72 6D 65 72 20 53 74 75 64 69
{150} normal block at 0x00727620, 8 bytes long.
Data: < % > 9C 25 08 01 00 00 00 00
{147} normal block at 0x00732F60, 24 bytes long.
Data: < /s > 98 2F 73 00 FF FF FF FF 00 00 00 00 00 00 00 00
{146} normal block at 0x00732ED0, 24 bytes long.
Data: < /s > 08 2F 73 00 FF FF FF FF 00 00 00 00 00 00 00 00
{145} normal block at 0x00732E88, 8 bytes long.
Data: <8# _ > 38 23 C4 5F 00 00 00 00
{144} normal block at 0x00732E38, 20 bytes long.
Data: < > 90 9D 8F 03 90 9D 8F 03 90 9D 8F 03 01 01 CD CD
{143} normal block at 0x00732DF8, 4 bytes long.
Data: < > 0C 00 00 00
{142} normal block at 0x00732DB8, 4 bytes long.
Data: < > 0B 00 00 00
Object dump complete.
My Code:
#define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <SFML/Graphics.hpp>
#include <string>
#include <sstream>
#include <iostream>
//window attributes
const unsigned int WINDOW_WIDTH = 800;
const unsigned int WINDOW_HEIGHT = 600;
const unsigned int MAX_FPS = 60;
const std::string WINDOW_NAME = "Platformer Studio v 1.0 inDev";
int main(){
sf::RenderWindow window(sf::VideoMode(WINDOW_WIDTH, WINDOW_HEIGHT), WINDOW_NAME, sf::Style::Close);
sf::Event event;
sf::Clock fpsTimer, updTimer;
int frames = 0;
window.setFramerateLimit(MAX_FPS);
while(window.isOpen()){
//events
while(window.pollEvent(event)){
switch(event.type){
case sf::Event::Closed:
window.close();
break;
}
}
//keyboard input
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
window.close();
++frames;
//set to a dark purple colour
window.clear(sf::Color(80, 0, 80, 255));
window.display();
//get frame rate and display it in the title bar
if(fpsTimer.getElapsedTime() >= sf::seconds(1)){
std::stringstream sstr;
sstr << WINDOW_NAME << " " << frames << " fps";
window.setTitle(sstr.str());
frames = 0;
fpsTimer.restart();
}
}
_CrtDumpMemoryLeaks();
return 0;
}
What does this mean? I am using VS2012 and SFML 2.0. thanks for any help