Page MenuHomeWildfire Games
Paste P174

CTextureManagerImpl::CTextureManagerImpl leak

Authored by elexis on Mon, Sep 9, 8:05 PM.
==362884== 27 (24 direct, 3 indirect) bytes in 1 blocks are definitely lost in loss record 266 of 2,942
==362884== at 0x4838DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
==362884== by 0x4ECFC5: allocate (new_allocator.h:114)
==362884== by 0x4ECFC5: allocate (alloc_traits.h:444)
==362884== by 0x4ECFC5: __allocate_guarded<std::allocator<std::_Sp_counted_deleter<unsigned char*, ArrayDeleter, std::allocator<void>, (__gnu_cxx::_Lock_policy)2> > > (allocated_ptr.h:97)
==362884== by 0x4ECFC5: __shared_count<unsigned char*, ArrayDeleter, std::allocator<void> > (shared_ptr_base.h:658)
==362884== by 0x4ECFC5: __shared_count<unsigned char*, ArrayDeleter> (shared_ptr_base.h:647)
==362884== by 0x4ECFC5: __shared_ptr<unsigned char, ArrayDeleter> (shared_ptr_base.h:1134)
==362884== by 0x4ECFC5: shared_ptr<unsigned char, ArrayDeleter> (shared_ptr.h:157)
==362884== by 0x4ECFC5: CTextureManagerImpl::CTextureManagerImpl(std::shared_ptr<IVFS>, bool, bool) (TextureManager.cpp:119)
==362884== by 0x4E7875: CTextureManager::CTextureManager(std::shared_ptr<IVFS>, bool, bool) (TextureManager.cpp:647)
==362884== by 0x51A0D7: CRendererInternals (Renderer.cpp:340)
==362884== by 0x51A0D7: CRenderer::CRenderer() (Renderer.cpp:414)
==362884== by 0x3A0B15: InitRenderer (GameSetup.cpp:595)
==362884== by 0x3A0B15: InitGraphics(CmdLineArgs const&, int, std::vector<CStr8, std::allocator<CStr8> > const&) (GameSetup.cpp:1084)
==362884== by 0x1A61EC: RunGameOrAtlas(int, char const**) (main.cpp:635)
==362884== by 0x1962E9: main (main.cpp:684)

Event Timeline

elexis created this paste.Mon, Sep 9, 8:05 PM
elexis created this object with visibility "Public (No Login Required)".
Stan added a subscriber: Stan.Mon, Sep 9, 8:08 PM

		if (!m_DisableGL)
			// Construct 1x1 24-bit texture
			shared_ptr<u8> data(new u8[3], ArrayDeleter());
			data.get()[0] = 255;
			data.get()[1] = 0;
			data.get()[2] = 255;
			Tex t;
			(void)t.wrap(1, 1, 24, 0, data, 0);

			m_ErrorHandle = ogl_tex_wrap(&t, m_VFS, L"(error texture)");
			(void)ogl_tex_set_filter(m_ErrorHandle, GL_LINEAR);
			if (!m_DisableGL)

			// Construct a CTexture to return to callers who want an error texture
			CTextureProperties props(L"(error texture)");
			m_ErrorTexture = CTexturePtr(new CTexture(m_ErrorHandle, props, this));
			m_ErrorTexture->m_State = CTexture::LOADED;
			m_ErrorTexture->m_Self = m_ErrorTexture;

if the array isn't freed that's three bytes lost each time