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

Author Topic: Valgrind reports 464 bytes lost in simple Window program  (Read 3063 times)

0 Members and 1 Guest are viewing this topic.

tejohnso

  • Newbie
  • *
  • Posts: 1
    • View Profile
Valgrind reports 464 bytes lost in simple Window program
« on: February 15, 2020, 10:40:20 pm »
Valgrind is showing leakage for the following program:

#include <SFML/Window.hpp>

int main() {
  sf::Window window(sf::VideoMode(800, 600), "demo");

  while (window.isOpen()) {
    sf::Event event;
    while (window.pollEvent(event)) {
      if (event.type == sf::Event::Closed) window.close();
    }
    window.display();
  }
}


==11744== Memcheck, a memory error detector
==11744== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==11744== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==11744== Command: build/exe/main/debug/demo
==11744==
==11744==
==11744== HEAP SUMMARY:
==11744==     in use at exit: 113,271 bytes in 963 blocks
==11744==   total heap usage: 22,480 allocs, 21,517 frees, 49,517,376 bytes allocated
==11744==
==11744== 28,072 (232 direct, 27,840 indirect) bytes in 1 blocks are definitely lost in loss record 65 of 67
==11744==    at 0x483977F: malloc (vg_replace_malloc.c:309)
==11744==    by 0x558A406: ???
==11744==    by 0x5592B4A: ???
==11744==    by 0x557F208: ???
==11744==    by 0x557AD14: ???
==11744==    by 0x557B28D: ???
==11744==    by 0x489E5BC: ??? (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x489DF9D: ??? (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x488CC68: ??? (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x488FA73: sf::Window::Window(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x1092C9: main (demo.cpp:4)
==11744==
==11744== 35,496 (232 direct, 35,264 indirect) bytes in 1 blocks are definitely lost in loss record 67 of 67
==11744==    at 0x483977F: malloc (vg_replace_malloc.c:309)
==11744==    by 0x558A406: ???
==11744==    by 0x5592B31: ???
==11744==    by 0x557F208: ???
==11744==    by 0x557AD14: ???
==11744==    by 0x557B28D: ???
==11744==    by 0x489E5BC: ??? (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x489DF9D: ??? (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x488CC68: ??? (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x488FA73: sf::Window::Window(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (in /usr/lib/libsfml-window.so.2.5.1)
==11744==    by 0x1092C9: main (demo.cpp:4)
==11744==
==11744== LEAK SUMMARY:
==11744==    definitely lost: 464 bytes in 2 blocks
==11744==    indirectly lost: 63,104 bytes in 272 blocks
==11744==      possibly lost: 0 bytes in 0 blocks
==11744==    still reachable: 49,703 bytes in 689 blocks
==11744==         suppressed: 0 bytes in 0 blocks
==11744== Reachable blocks (those to which a pointer was found) are not shown.

Is this a known problem on Linux?  I'm running Arch with Kernel 5.5.3

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: Valgrind reports 464 bytes lost in simple Window program
« Reply #1 on: February 17, 2020, 02:17:47 pm »
That's normal. Due to some global variable in the SFML code. No worries there.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord

 

anything