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

Author Topic: Memory corruption error  (Read 5724 times)

0 Members and 3 Guests are viewing this topic.

wetnightmares

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Memory corruption error
« on: March 31, 2015, 12:14:31 pm »
I'm using SFML with Ubuntu 12.04.4 on and Oracle VM and compiling with QT4.8.1.

I followed this tutorial https://github.com/SFML/SFML/wiki/Tutorial:-Compile-and-Link-SFML-with-Qt-Creator for downloading and building SFML.

I've had success in running a project, but since a VM crash I started running into issues. I've since re-downloaded and re-built SFML from scratch a few times without success. I'm not sure if the issue is with SFML or if it's my VM but I'm not sure where else to post.


Entry point for application
//main.cpp

#include <iostream>
#include <SFML/Graphics.hpp>
#include "frame.h"

int main()
{

    Frame frame(sf::VideoMode(800,600,32), "Test");
    frame.Run();
    return 0;

}

 

Frame header

//Frame.h

#ifndef FRAME_H
#define FRAME_H

#include <SFML/Graphics.hpp>

class Frame
{
public:
    Frame(sf::VideoMode, std::string, float frameRate_ = 120.0f);
    void Run();
    ~Frame(){}
private:
    sf::RenderWindow *window;
    sf::RectangleShape background;
    sf::RectangleShape hand;
};

#endif // FRAME_H


 

Frame class
//Frame.cpp

#include "frame.h"
#include <iostream>
#include "SFML/Graphics.hpp"

Frame::Frame(sf::VideoMode screen, std::string title, float frameRate_)
{
    sf::Texture *texture = new sf::Texture();
    texture->loadFromFile("Images/cash_back.png");
    texture->setSmooth(true);
    background.setTexture(texture);
    background.setPosition(sf::Vector2f(0.0f,0.0f));
    background.setSize(sf::Vector2f(800.0f,600.0f));
    hand.setFillColor(sf::Color::Green);

    window = new sf::RenderWindow(screen, title);
    window->setFramerateLimit(frameRate_);
    window->draw(background);

}

void Frame::Run()
{
    bool running = true;
    sf::Event ev;
    while(running)
    {
        while(window->pollEvent(ev))
        {
            if(ev.type == sf::Event::Closed)
            {
                running = false;
            }
        }
        window->setActive();
    }
    std::cout<<"bingo"<<std::endl;
}

 


The initial error message I received after running
./Test
was

*** glibc detected *** ./Test: malloc(): memory corruption: 0x00000000025fa780 ***

So I downloaded Valgrind and tried running
valgrind --track-origins=yes ./Test
 

and the output was:

user@user-VirtualBox:~/Hover/Projects/Test-build-desktop-Qt_4_8_1_in_PATH__System__Debug$ sudo valgrind --track-origins=yes ./Test
==4441== Memcheck, a memory error detector
==4441== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==4441== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==4441== Command: ./Test
==4441==
==4441== Invalid write of size 8
==4441==    at 0x4E7F98D: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceef0 is 0 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 4
==4441==    at 0x4E89331: sf::Vector2<float>::Vector2(float, float) (Vector2.inl:40)
==4441==    by 0x4E8A2CD: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceef0 is 0 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 4
==4441==    at 0x4E8933A: sf::Vector2<float>::Vector2(float, float) (Vector2.inl:40)
==4441==    by 0x4E8A2CD: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceef4 is 4 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 1
==4441==    at 0x4E5C2A0: sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char) (Color.cpp:64)
==4441==    by 0x4E8A2F2: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceef8 is 8 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 1
==4441==    at 0x4E5C2AA: sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char) (Color.cpp:64)
==4441==    by 0x4E8A2F2: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceef9 is 9 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 1
==4441==    at 0x4E5C2B5: sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char) (Color.cpp:64)
==4441==    by 0x4E8A2F2: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceefa is 10 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 1
==4441==    at 0x4E5C2C0: sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char) (Color.cpp:64)
==4441==    by 0x4E8A2F2: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceefb is 11 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 4
==4441==    at 0x4E89331: sf::Vector2<float>::Vector2(float, float) (Vector2.inl:40)
==4441==    by 0x4E8A308: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1ceefc is 12 bytes after a block of size 496 alloc'd
==4441==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x4021B3: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==
==4441== Invalid write of size 4
==4441==    at 0x4E8933A: sf::Vector2<float>::Vector2(float, float) (Vector2.inl:40)
==4441==    by 0x4E8A308: sf::Vertex::Vertex() (Vertex.cpp:37)
==4441==    by 0x4E80D92: sf::RenderTarget::StatesCache::StatesCache() (in /usr/lib/libsfml-graphics-d.so.2.2)
==4441==    by 0x4E7F9A1: sf::RenderTarget::RenderTarget() (RenderTarget.cpp:79)
==4441==    by 0x4E80EE5: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:42)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1cef00 is not stack'd, malloc'd or (recently) free'd
==4441==
==4441== Conditional jump or move depends on uninitialised value(s)
==4441==    at 0x4C2BFC9: __GI_strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x55AF5CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==4441==    by 0x50E1B36: (anonymous namespace)::getJoystickName(int, unsigned int) (JoystickImpl.cpp:122)
==4441==    by 0x50E2257: sf::priv::JoystickImpl::open(unsigned int) (JoystickImpl.cpp:274)
==4441==    by 0x50CA428: sf::priv::JoystickManager::update() (JoystickManager.cpp:90)
==4441==    by 0x50CE8B6: sf::priv::WindowImpl::WindowImpl() (WindowImpl.cpp:87)
==4441==    by 0x50D45FF: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&) (WindowImplX11.cpp:395)
==4441==    by 0x50CE760: sf::priv::WindowImpl::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (WindowImpl.cpp:71)
==4441==    by 0x50CDD3A: sf::Window::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (Window.cpp:124)
==4441==    by 0x4E80F2E: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:45)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Uninitialised value was created by a stack allocation
==4441==    at 0x50E1AB8: (anonymous namespace)::getJoystickName(int, unsigned int) (JoystickImpl.cpp:117)
==4441==
==4441== Conditional jump or move depends on uninitialised value(s)
==4441==    at 0x4C2BFD8: __GI_strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x55AF5CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==4441==    by 0x50E1B36: (anonymous namespace)::getJoystickName(int, unsigned int) (JoystickImpl.cpp:122)
==4441==    by 0x50E2257: sf::priv::JoystickImpl::open(unsigned int) (JoystickImpl.cpp:274)
==4441==    by 0x50CA428: sf::priv::JoystickManager::update() (JoystickManager.cpp:90)
==4441==    by 0x50CE8B6: sf::priv::WindowImpl::WindowImpl() (WindowImpl.cpp:87)
==4441==    by 0x50D45FF: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&) (WindowImplX11.cpp:395)
==4441==    by 0x50CE760: sf::priv::WindowImpl::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (WindowImpl.cpp:71)
==4441==    by 0x50CDD3A: sf::Window::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (Window.cpp:124)
==4441==    by 0x4E80F2E: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:45)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Uninitialised value was created by a stack allocation
==4441==    at 0x50E1AB8: (anonymous namespace)::getJoystickName(int, unsigned int) (JoystickImpl.cpp:117)
==4441==
==4441== Use of uninitialised value of size 8
==4441==    at 0x557D1A4: std::ctype<wchar_t>::do_widen(char) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==4441==    by 0x5303B19: std::__ctype_abstract_base<wchar_t>::widen(char) const (locale_facets.h:288)
==4441==    by 0x53029FC: unsigned int sf::Utf<32u>::decodeAnsi<char>(char, std::locale const&) (Utf.inl:662)
==4441==    by 0x5302C44: std::back_insert_iterator<std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> > > sf::Utf<32u>::fromAnsi<__gnu_cxx::__normal_iterator<char const*, std::string>, std::back_insert_iterator<std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> > > >(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, std::back_insert_iterator<std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> > >, std::locale const&) (Utf.inl:543)
==4441==    by 0x5301EC0: sf::String::String(std::string const&, std::locale const&) (String.cpp:86)
==4441==    by 0x50E226E: sf::priv::JoystickImpl::open(unsigned int) (JoystickImpl.cpp:274)
==4441==    by 0x50CA428: sf::priv::JoystickManager::update() (JoystickManager.cpp:90)
==4441==    by 0x50CE8B6: sf::priv::WindowImpl::WindowImpl() (WindowImpl.cpp:87)
==4441==    by 0x50D45FF: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&) (WindowImplX11.cpp:395)
==4441==    by 0x50CE760: sf::priv::WindowImpl::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (WindowImpl.cpp:71)
==4441==    by 0x50CDD3A: sf::Window::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (Window.cpp:124)
==4441==    by 0x4E80F2E: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:45)
==4441==  Uninitialised value was created by a stack allocation
==4441==    at 0x50E1AB8: (anonymous namespace)::getJoystickName(int, unsigned int) (JoystickImpl.cpp:117)
==4441==
Unable to get joystick attribute. Could not find USB device for joystick at index 0.
Unable to get joystick attribute. Could not find USB device for joystick at index 0.
==4441== Invalid read of size 8
==4441==    at 0x74840E7: xcb_ewmh_get_supporting_wm_check (in /usr/lib/libxcb-ewmh.so.1.0.0)
==4441==    by 0x50D39B4: (anonymous namespace)::ewmhSupported() (WindowImplX11.cpp:152)
==4441==    by 0x50D47A7: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&) (WindowImplX11.cpp:410)
==4441==    by 0x50CE760: sf::priv::WindowImpl::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (WindowImpl.cpp:71)
==4441==    by 0x50CDD3A: sf::Window::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (Window.cpp:124)
==4441==    by 0x4E80F2E: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:45)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0xf1d2f88 is 8 bytes after a block of size 32 free'd
==4441==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4441==    by 0x6A54424: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==4441==    by 0x6A528B3: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==4441==    by 0x6A53D7E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==4441==    by 0x6A53F9A: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==4441==    by 0x74832C6: xcb_ewmh_init_atoms_replies (in /usr/lib/libxcb-ewmh.so.1.0.0)
==4441==    by 0x50D3938: (anonymous namespace)::ewmhSupported() (WindowImplX11.cpp:133)
==4441==    by 0x50D47A7: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&) (WindowImplX11.cpp:410)
==4441==    by 0x50CE760: sf::priv::WindowImpl::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (WindowImpl.cpp:71)
==4441==    by 0x50CDD3A: sf::Window::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (Window.cpp:124)
==4441==    by 0x4E80F2E: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:45)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==
==4441== Invalid read of size 4
==4441==    at 0x74840F7: xcb_ewmh_get_supporting_wm_check (in /usr/lib/libxcb-ewmh.so.1.0.0)
==4441==    by 0x50D39B4: (anonymous namespace)::ewmhSupported() (WindowImplX11.cpp:152)
==4441==    by 0x50D47A7: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&) (WindowImplX11.cpp:410)
==4441==    by 0x50CE760: sf::priv::WindowImpl::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (WindowImpl.cpp:71)
==4441==    by 0x50CDD3A: sf::Window::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (Window.cpp:124)
==4441==    by 0x4E80F2E: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:45)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==4441==
==4441==
==4441== Process terminating with default action of signal 11 (SIGSEGV)
==4441==  Access not within mapped region at address 0x0
==4441==    at 0x74840F7: xcb_ewmh_get_supporting_wm_check (in /usr/lib/libxcb-ewmh.so.1.0.0)
==4441==    by 0x50D39B4: (anonymous namespace)::ewmhSupported() (WindowImplX11.cpp:152)
==4441==    by 0x50D47A7: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&) (WindowImplX11.cpp:410)
==4441==    by 0x50CE760: sf::priv::WindowImpl::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (WindowImpl.cpp:71)
==4441==    by 0x50CDD3A: sf::Window::create(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (Window.cpp:124)
==4441==    by 0x4E80F2E: sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&) (RenderWindow.cpp:45)
==4441==    by 0x4021DC: Frame::Frame(sf::VideoMode, std::string, float) (frame.cpp:15)
==4441==    by 0x401D1D: main (main.cpp:8)
==4441==  If you believe this happened as a result of a stack
==4441==  overflow in your program's main thread (unlikely but
==4441==  possible), you can try to increase the size of the
==4441==  main thread stack using the --main-stacksize= flag.
==4441==  The main thread stack size used in this run was 8388608.
==4441==
==4441== HEAP SUMMARY:
==4441==     in use at exit: 9,234,629 bytes in 3,765 blocks
==4441==   total heap usage: 8,748 allocs, 4,983 frees, 20,483,848 bytes allocated
==4441==
==4441== LEAK SUMMARY:
==4441==    definitely lost: 114 bytes in 2 blocks
==4441==    indirectly lost: 0 bytes in 0 blocks
==4441==      possibly lost: 108,193 bytes in 1,271 blocks
==4441==    still reachable: 9,126,322 bytes in 2,492 blocks
==4441==         suppressed: 0 bytes in 0 blocks
==4441== Rerun with --leak-check=full to see details of leaked memory
==4441==
==4441== For counts of detected and suppressed errors, rerun with: -v
==4441== ERROR SUMMARY: 56 errors from 14 contexts (suppressed: 3 from 3)
 

So is it an issue with SFML? Is my VM corrupt? The VM has access to 12gb of ram and has a dynamically allocated hard disk so I dont think it's a lack of memory issue. I'm not exactly new to SFML but I'm somewhat new to QT and Linux.

Your help would be greatly appreciated.

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Memory corruption error
« Reply #1 on: March 31, 2015, 12:42:55 pm »
I think your problem is

sf::Texture *texture = new sf::Texture();

You never destroy that texture.

Just set sf::Texture texture as a Member of Frame and I think you should be fine.

wetnightmares

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Memory corruption error
« Reply #2 on: March 31, 2015, 12:50:09 pm »
Good catch, I'm too used to having pointers cleaned up after me. After Fixing that it gives me
Unable to get joystick attribute. Could not find usb device for joystick at index 0.

I've seen something about this error before and checked to make sure my JoystickImpl and JoystickManager files were the updated ones and they are.

wetnightmares

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Memory corruption error
« Reply #3 on: March 31, 2015, 01:09:32 pm »
This is the new valgring output
(click to show/hide)
« Last Edit: March 31, 2015, 02:20:51 pm by wetnightmares »

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Memory corruption error
« Reply #4 on: March 31, 2015, 01:51:48 pm »
I'm not sure what the point of posting valgrind output is... it is known that valgrind 'detects' memory leaks within SFML.

Unable to get joystick attribute. Could not find usb device for joystick at index 0.

https://github.com/SFML/SFML/pull/838
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

wetnightmares

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Memory corruption error
« Reply #5 on: March 31, 2015, 02:09:58 pm »
Ah didn't realize the memory leak was normal, saw that joystick was recurring and thought it might be the root of the issue.

Thanks for your help

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Memory corruption error
« Reply #6 on: March 31, 2015, 02:19:14 pm »
Ah didn't realize the memory leak was normal

Normal? No, SFML doesn't leak memory, but that is hard to explain that to someone who trusts exactly what valgrind says. All memory leak detection tools have false positives.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

wetnightmares

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Memory corruption error
« Reply #7 on: March 31, 2015, 02:27:05 pm »
This is my first time using Valgrind, I'm still not entirely sure what it's telling me.

I read through that link you gave me and updated the JoystickImp.cpp and .h, it seems I'm having the same issue as zwookie did initially, although I built the debug libraries and am linking statically. Do I need to rebuild the libraries with these files in my src?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Memory corruption error
« Reply #8 on: March 31, 2015, 02:35:20 pm »
Learn to use git, manually changing files from a diff isn't the way to go. Also if you use static linking please at least understand what it does and how the compile/link process works. Changing source files doesn't change compiled binaries automatically.

http://en.sfml-dev.org/forums/index.php?topic=17798.0
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

wetnightmares

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Memory corruption error
« Reply #9 on: March 31, 2015, 02:44:10 pm »
Thanks a lot

 

anything