1
Graphics / LNK4098 warning for LIBCMT while building graphics DLL
« on: November 11, 2011, 01:44:06 am »
Laurent and slotdev, thanks for the clarification.
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.
When you say "SFML static libs", is it just BUILD_SHARED_LIBS which is disabled, or did you also enable STATIC_STD_LIBS?
But anyway, avoid globals, especially SFML resources that use OpenGL and require an OpenGL context, they will always cause problems.
Linking CXX shared library ..\..\..\lib\sfml-graphics-2.dll
Creating library ..\..\..\lib\sfml-graphics.lib and object ..\..\..\lib\sfml-graphics.exp
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
#include <SFML/Graphics.hpp>
sf::Texture texture;
int main() {
return 0;
}
ntdll.dll!77aa22c2()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
> testimage.exe!sf::priv::MutexImpl::Lock() Line 52 + 0xc bytes C++
testimage.exe!sf::Mutex::Lock() Line 62 C++
testimage.exe!sf::Lock::Lock(sf::Mutex & mutex) Line 39 C++
testimage.exe!sf::GlResource::GlResource() Line 52 + 0xd bytes C++
testimage.exe!sf::Texture::Texture() Line 48 + 0x16 bytes C++
testimage.exe!`dynamic initializer for 'texture''() Line 3 + 0x28 bytes C++
msvcr100d.dll!_initterm(void (void)* * pfbegin, void (void)* * pfend) Line 873 C
testimage.exe!__tmainCRTStartup() Line 473 + 0xf bytes C
testimage.exe!mainCRTStartup() Line 371 C
kernel32.dll!7530339a()
ntdll.dll!77ab9ed2()
ntdll.dll!77ab9ea5()
class MyImageLoader : public Thread {
MyImageLoader(string imageName);
void Run() {
image = new Image();
// load the image data and do some moderate processing on it
ready = true;
}
};
class MyImage {
MyImage(string imageName) {
myImage = NULL;
myLoader = new MyImageLoader(imageName);
myLoader->Launch();
}
void Draw(RenderWindow window) {
// If loader is done, take our image and cleanup the loader.
if (myLoader && myLoader.ready) {
myImage = myLoader->image;
delete myLoader;
myLoader = NULL;
}
// If we have our image, draw it. Otherwise, it must be
// loading -- draw nothing.
if (myImage) {
window.Draw(new Sprite(*myImage));
}
}
};
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
// When running either test with main1, the program's memory footprint
// will remain more or less static.
// When running either test with main2, the program's memory footprint
// will grow rapidly until it exhausts system resources.
// CONFIG
#define TEST test1 // test to run, either test1 or test2
#define MAIN main1 // main method to use, either main1 or main2
// test1 creates a user GlContext explicitly
void test1() {
// ** Thread is contextless
sf::Context c1;
// ** Thread has active context c1
} // c1 goes out of scope
// ~Context is called for c1:
// myContext->~GlContext calls GetInternalContext()->SetActive(true) during
// c1.SetActive(false)
// Because we did not previously have an internal context,
// GetIntrnalContext() creates one, then SetActive(true) makes it active
// ** Thread has active internal context
// ** internalContexts.size() increases by 1
// ~GlResource is called for c1:
// If there are no other GlResources (ex. a RenderWindow in the main
// thread), then
// We call GlContext::GlobalCleanup():
// ** Thread's internal context is deleted
// ** internalContexts.size() is 0
// Otherwise, there are other resources -- postpone cleanup
// ** internalContexts.size() remains unchanged
// test2 creates an internal GlContext implicitly
void test2() {
// ** Thread is contextless
sf::Image* image = new sf::Image(); // calls EnsureContext()
// EnsureContext() calls GetInternalContext(), and because we
// have no internal context at this point, one is created and activated
// ** Thread has active internal context
// ** internalContexts.size() increases by 1
delete image;
// image is deleted:
// ~GlResource is called for image:
// If there are no other GlResources (ex. a RenderWindow in the main
// thread), then
// We call GlContext::GlobalCleanup():
// ** Thread's internal context is deleted
// ** internalContexts.size() is 0
// Otherwise, there are other resources -- postpone cleanup
// ** internalContexts.size() remains unchanged
}
// main1 runs fine with either test1 or test2
void main1() {
// ** internalContexts.size() is 0
while (true) {
sf::Thread thread(&TEST);
thread.Launch();
// ** internalContexts.size() increases by 1 during thread's run
thread.Wait();
// ** internalContexts.size() returns to 0
// When last GlResource goes out of scope we
// call GlContext::GlobalCleanup() -- memory
// footprint remains the same.
}
}
// main2 continually consumes resources with either test1 or test2
void main2() {
// ** internalContexts.size() is 0
sf::RenderWindow window;
// ** internalContexts.size() is 1
while (true) {
sf::Thread thread(&TEST);
thread.Launch();
// ** internalContexts.size() increases by 1 during thread's run
thread.Wait();
// ** internalContexts.size() remains unchanged
// GlContext::GlobalCleanup() is not called because
// sf::RenderWindow remains in scope and keeps
// GlResource::count at 2 -- memory footprint
// grows until we either run out of memory or exhaust
// system resources (i.e. X display connections),
// then we may get GL errors or program crash.
}
}
int main() {
MAIN();
return 0;
}
--- SFML/Window/GlContext.cpp:223 ---
if (this == currentContext)
{
// To deactivate the context, we actually activate another one so that we make
// sure that there is always an active context for subsequent graphics operations
return GetInternalContext()->SetActive(true);
}
if (this == currentContext)
{
currentContext = NULL;
if (internalContext && (this != internalContext)) {
return internalContext->SetActive(true);
} else {
return true;
}
}
==30039== Memcheck, a memory error detector
==30039== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==30039== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==30039== Command: ./testcontext4
==30039==
==30039==
==30039== HEAP SUMMARY:
==30039== in use at exit: 218,235,115 bytes in 32,584 blocks
==30039== total heap usage: 50,698 allocs, 18,114 frees, 241,961,036 bytes allocated
==30039==
<snip>
==30039== 24,117,248 bytes in 23 blocks are still reachable in loss record 673 of 676
==30039== at 0x4025018: malloc (vg_replace_malloc.c:236)
==30039== by 0x4C39A2C: _mesa_malloc (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4CB4C4B: _swrast_CreateContext (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4BF934F: ??? (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4508625: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E44AF: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E5BFF: glXCreateContext (in /usr/lib/libGL.so.1.2)
==30039== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==30039== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==30039== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==30039== by 0x40FA4F5: sf::priv::GlContext::EnsureContext() (GlContext.cpp:138)
==30039== by 0x40FB929: sf::GlResource::GlResource() (GlResource.cpp:64)
==30039==
==30039== 35,276,544 bytes in 24 blocks are still reachable in loss record 674 of 676
==30039== at 0x40235D0: memalign (vg_replace_malloc.c:581)
==30039== by 0x402368E: posix_memalign (vg_replace_malloc.c:709)
==30039== by 0x4C398DA: _mesa_align_malloc (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4C399AB: _mesa_align_calloc (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4C8E5BF: _tnl_init_vertices (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4CE79CC: _swsetup_CreateContext (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4BF9367: ??? (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4508625: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E44AF: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E5BFF: glXCreateContext (in /usr/lib/libGL.so.1.2)
==30039== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==30039== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==30039==
==30039== 38,720,000 bytes in 800 blocks are still reachable in loss record 675 of 676
==30039== at 0x40235D0: memalign (vg_replace_malloc.c:581)
==30039== by 0x402368E: posix_memalign (vg_replace_malloc.c:709)
==30039== by 0x4C398DA: _mesa_align_malloc (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4D61F31: _mesa_vector4f_alloc (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4C7B809: ??? (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4C7855C: _tnl_install_pipeline (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4C78268: _tnl_CreateContext (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4BF935F: ??? (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4508625: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E44AF: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E5BFF: glXCreateContext (in /usr/lib/libGL.so.1.2)
==30039== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==30039==
==30039== 51,343,544 bytes in 23 blocks are still reachable in loss record 676 of 676
==30039== at 0x4025018: malloc (vg_replace_malloc.c:236)
==30039== by 0x4C39A2C: _mesa_malloc (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4CB4BE6: _swrast_CreateContext (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4BF934F: ??? (in /usr/lib/dri/swrast_dri.so)
==30039== by 0x4508625: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E44AF: ??? (in /usr/lib/libGL.so.1.2)
==30039== by 0x44E5BFF: glXCreateContext (in /usr/lib/libGL.so.1.2)
==30039== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==30039== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==30039== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==30039== by 0x40FA4F5: sf::priv::GlContext::EnsureContext() (GlContext.cpp:138)
==30039== by 0x40FB929: sf::GlResource::GlResource() (GlResource.cpp:64)
==30039==
==30039== LEAK SUMMARY:
==30039== definitely lost: 24,512 bytes in 131 blocks
==30039== indirectly lost: 983,280 bytes in 4,820 blocks
==30039== possibly lost: 18,520 bytes in 91 blocks
==30039== still reachable: 217,208,803 bytes in 27,542 blocks
==30039== suppressed: 0 bytes in 0 blocks
==30039==
==30039== For counts of detected and suppressed errors, rerun with: -v
==30039== ERROR SUMMARY: 18 errors from 18 contexts (suppressed: 89 from 12)
==28864== Memcheck, a memory error detector
==28864== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==28864== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==28864== Command: ./testcontext4
==28864==
==28864==
==28864== HEAP SUMMARY:
==28864== in use at exit: 777,424,068 bytes in 116,874 blocks
==28864== total heap usage: 174,908 allocs, 58,034 frees, 869,300,595 bytes allocated
==28864==
==28864== 124 bytes in 1 blocks are definitely lost in loss record 280 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x473ABC2: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473AC63: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A5A3: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A8DB: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x456BD72: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x455BC16: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x4101523: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:47)
==28864== by 0x40FA381: sf::priv::GlContext::GlobalInit() (GlContext.cpp:108)
==28864== by 0x40FB90A: sf::GlResource::GlResource() (GlResource.cpp:57)
==28864== by 0x40FE41D: sf::Window::Window() (Window.cpp:53)
==28864== by 0x4070565: sf::RenderWindow::RenderWindow() (RenderWindow.cpp:34)
==28864==
==28864== 124 bytes in 1 blocks are definitely lost in loss record 281 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x473ABC2: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473AC63: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A5A3: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A8DB: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x456BD72: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x455BC16: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x4102B1D: sf::priv::VideoModeImpl::GetDesktopMode() (VideoModeImpl.cpp:122)
==28864== by 0x40FBDD7: sf::VideoMode::GetDesktopMode() (VideoMode.cpp:60)
==28864== by 0x4101637: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA381: sf::priv::GlContext::GlobalInit() (GlContext.cpp:108)
==28864== by 0x40FB90A: sf::GlResource::GlResource() (GlResource.cpp:57)
==28864==
==28864== 124 bytes in 1 blocks are definitely lost in loss record 282 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x473ABC2: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473AC63: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A5A3: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A8DB: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x456BD72: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x455BC16: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x4101523: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:47)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864== by 0x40FA798: sf::priv::GlContext::SetActive(bool) (GlContext.cpp:227)
==28864== by 0x40FA3AD: sf::priv::GlContext::GlobalInit() (GlContext.cpp:114)
==28864==
==28864== 124 bytes in 1 blocks are definitely lost in loss record 283 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x473ABC2: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473AC63: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A5A3: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A8DB: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x456BD72: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x455BC16: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x41036F9: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, std::string const&, unsigned long) (WindowImplX11.cpp:114)
==28864== by 0x40FF132: sf::priv::WindowImpl::New(sf::VideoMode, std::string const&, unsigned long) (WindowImpl.cpp:58)
==28864== by 0x40FE82C: sf::Window::Create(sf::VideoMode, std::string const&, unsigned long, sf::ContextSettings const&) (Window.cpp:126)
==28864== by 0x8048FC7: main (testcontext4.cpp:27)
==28864==
==28864== 160 bytes in 1 blocks are possibly lost in loss record 290 of 678
==28864== at 0x4023796: calloc (vg_replace_malloc.c:467)
==28864== by 0x401103B: _dl_allocate_tls (dl-tls.c:300)
==28864== by 0x43BC5A0: pthread_create@@GLIBC_2.1 (allocatestack.c:579)
==28864== by 0x411980B: sf::priv::ThreadImpl::ThreadImpl(sf::Thread*) (ThreadImpl.cpp:41)
==28864== by 0x41194CF: sf::Thread::Launch() (Thread.cpp:52)
==28864== by 0x8049018: main (testcontext4.cpp:31)
==28864==
==28864== 282 bytes in 1 blocks are definitely lost in loss record 322 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x4508253: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8063: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA381: sf::priv::GlContext::GlobalInit() (GlContext.cpp:108)
==28864== by 0x40FB90A: sf::GlResource::GlResource() (GlResource.cpp:57)
==28864== by 0x40FE41D: sf::Window::Window() (Window.cpp:53)
==28864==
==28864== 282 bytes in 1 blocks are definitely lost in loss record 323 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x4508253: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8063: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410171D: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*, sf::ContextSettings const&, sf::priv::WindowImpl const*, unsigned int) (GlxContext.cpp:80)
==28864== by 0x40FA5C1: sf::priv::GlContext::New(sf::ContextSettings const&, sf::priv::WindowImpl const*, unsigned int) (GlContext.cpp:159)
==28864== by 0x40FE850: sf::Window::Create(sf::VideoMode, std::string const&, unsigned long, sf::ContextSettings const&) (Window.cpp:129)
==28864== by 0x8048FC7: main (testcontext4.cpp:27)
==28864==
==28864== 282 bytes in 1 blocks are definitely lost in loss record 324 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x4508253: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8063: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864== by 0x40FA798: sf::priv::GlContext::SetActive(bool) (GlContext.cpp:227)
==28864==
==28864== 10,404 bytes in 51 blocks are possibly lost in loss record 524 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8191: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864==
==28864== 11,408 bytes in 92 blocks are definitely lost in loss record 532 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x473ABC2: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473AC63: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A5A3: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A8DB: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x456BD72: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x455BC16: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x4101523: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:47)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864== by 0x40FA4F5: sf::priv::GlContext::EnsureContext() (GlContext.cpp:138)
==28864== by 0x40FB929: sf::GlResource::GlResource() (GlResource.cpp:64)
==28864==
==28864== 11,532 bytes in 93 blocks are definitely lost in loss record 533 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x473ABC2: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473AC63: ??? (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A5A3: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x473A8DB: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==28864== by 0x456BD72: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x455BC16: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==28864== by 0x4102B1D: sf::priv::VideoModeImpl::GetDesktopMode() (VideoModeImpl.cpp:122)
==28864== by 0x40FBDD7: sf::VideoMode::GetDesktopMode() (VideoMode.cpp:60)
==28864== by 0x4101637: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864==
==28864== 13,056 (204 direct, 12,852 indirect) bytes in 1 blocks are definitely lost in loss record 540 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8191: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA381: sf::priv::GlContext::GlobalInit() (GlContext.cpp:108)
==28864== by 0x40FB90A: sf::GlResource::GlResource() (GlResource.cpp:57)
==28864==
==28864== 13,056 (204 direct, 12,852 indirect) bytes in 1 blocks are definitely lost in loss record 541 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8191: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410171D: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*, sf::ContextSettings const&, sf::priv::WindowImpl const*, unsigned int) (GlxContext.cpp:80)
==28864== by 0x40FA5C1: sf::priv::GlContext::New(sf::ContextSettings const&, sf::priv::WindowImpl const*, unsigned int) (GlContext.cpp:159)
==28864== by 0x40FE850: sf::Window::Create(sf::VideoMode, std::string const&, unsigned long, sf::ContextSettings const&) (Window.cpp:129)
==28864==
==28864== 25,944 bytes in 92 blocks are definitely lost in loss record 568 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x4508253: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8063: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864== by 0x40FA4F5: sf::priv::GlContext::EnsureContext() (GlContext.cpp:138)
==28864==
==28864== 26,112 (204 direct, 25,908 indirect) bytes in 1 blocks are definitely lost in loss record 569 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E81D3: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA381: sf::priv::GlContext::GlobalInit() (GlContext.cpp:108)
==28864== by 0x40FB90A: sf::GlResource::GlResource() (GlResource.cpp:57)
==28864==
==28864== 26,112 (204 direct, 25,908 indirect) bytes in 1 blocks are definitely lost in loss record 570 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E81D3: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410171D: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*, sf::ContextSettings const&, sf::priv::WindowImpl const*, unsigned int) (GlxContext.cpp:80)
==28864== by 0x40FA5C1: sf::priv::GlContext::New(sf::ContextSettings const&, sf::priv::WindowImpl const*, unsigned int) (GlContext.cpp:159)
==28864== by 0x40FE850: sf::Window::Create(sf::VideoMode, std::string const&, unsigned long, sf::ContextSettings const&) (Window.cpp:129)
==28864==
==28864== 60,996 bytes in 299 blocks are possibly lost in loss record 593 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E81D3: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864==
==28864== 1,191,564 (18,972 direct, 1,172,592 indirect) bytes in 93 blocks are definitely lost in loss record 640 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E8191: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864==
==28864== 2,367,420 (18,768 direct, 2,348,652 indirect) bytes in 92 blocks are definitely lost in loss record 653 of 678
==28864== at 0x4025018: malloc (vg_replace_malloc.c:236)
==28864== by 0x44E3E6A: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E7EA8: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E81D3: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x450C624: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E84E1: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E54B2: ??? (in /usr/lib/libGL.so.1.2)
==28864== by 0x44E55E4: glXGetConfig (in /usr/lib/libGL.so.1.2)
==28864== by 0x4101C67: sf::priv::GlxContext::CreateContext(sf::priv::GlxContext*, unsigned int, sf::ContextSettings const&) (GlxContext.cpp:197)
==28864== by 0x410165A: sf::priv::GlxContext::GlxContext(sf::priv::GlxContext*) (GlxContext.cpp:62)
==28864== by 0x40FA541: sf::priv::GlContext::New() (GlContext.cpp:145)
==28864== by 0x40FA2BB: (anonymous namespace)::GetInternalContext() (GlContext.cpp:90)
==28864==
==28864== LEAK SUMMARY:
==28864== definitely lost: 88,782 bytes in 473 blocks
==28864== indirectly lost: 3,598,764 bytes in 17,641 blocks
==28864== possibly lost: 71,560 bytes in 351 blocks
==28864== still reachable: 773,664,962 bytes in 98,409 blocks
==28864== suppressed: 0 bytes in 0 blocks
==28864== Reachable blocks (those to which a pointer was found) are not shown.
==28864== To see them, rerun with: --leak-check=full --show-reachable=yes
==28864==
==28864== For counts of detected and suppressed errors, rerun with: -v
==28864== ERROR SUMMARY: 19 errors from 19 contexts (suppressed: 89 from 12)
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#define NULL_RUN 0 // when 1, skip image creation loop
class ContextThread : public sf::Thread {
public:
ContextThread() :
sf::Thread(&ContextThread::Run, this)
{
// ctor
}
void Run() {
#if !NULL_RUN
for (int i = 0; i < 10; i++) {
sf::Image* image = new sf::Image();
image->Create(100, 100);
delete image;
}
#endif
}
};
int main() {
sf::RenderWindow app;
app.Create(sf::VideoMode(800, 600, 32), "Test", sf::Style::Close);
while (app.IsOpened()) {
ContextThread* thread = new ContextThread();
thread->Launch();
thread->Wait();
delete thread;
sf::Event Event;
while (app.PollEvent(Event))
{
// Exit on window close
if (Event.Type == sf::Event::Closed) {
app.Close();
}
}
}
return 0;
}
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#define NULL_RUN 0 // when 1, skip context creation
class ContextThread : public sf::Thread {
public:
ContextThread() :
sf::Thread(&ContextThread::Run, this)
{
// ctor
}
void Run() {
#if !NULL_RUN
sf::Context context;
#endif
}
};
int main() {
sf::RenderWindow app;
app.Create(sf::VideoMode(800, 600, 32), "Test", sf::Style::Close);
while (app.IsOpened()) {
ContextThread* thread = new ContextThread();
thread->Launch();
thread->Wait();
delete thread;
sf::Event Event;
while (app.PollEvent(Event))
{
// Exit on window close
if (Event.Type == sf::Event::Closed) {
app.Close();
}
}
}
return 0;
}