T3D 1.1 Beta 2 - some memory leak - LOGGED
by Song Yongjin · in Torque 3D Professional · 08/26/2010 (5:34 am) · 5 replies
OS : win xp
target : program
issue : memory leak
<platformWin32/winVolime.cpp>
Torque::FS::FileSystemRef Platform::FS::createNativeFS( const String &volume )
{
return new Win32::Win32FileSystem( volume ); <= this !!
}
<gfx/D3D9/gfxD3D9Shader.cpp>
GFXD3D9Shader::GFXD3D9Shader()
{
....
if( smD3DXInclude == NULL )
smD3DXInclude = new _gfxD3DXInclude; <= this !!
}
<core/volume.cpp>
bool MountSystem::mount(String root,const Path &path)
{
return mount(root, new FileSystemRedirect(this,_normalize(path))); <= this !!
}
<platformWin32/winDLibrary.cpp>
DLibraryRef OsLoadLibrary(const char* file)
{
Win32DLibrary* library = new Win32DLibrary(); <= this !!
....
}
target : program
issue : memory leak
<platformWin32/winVolime.cpp>
Torque::FS::FileSystemRef Platform::FS::createNativeFS( const String &volume )
{
return new Win32::Win32FileSystem( volume ); <= this !!
}
<gfx/D3D9/gfxD3D9Shader.cpp>
GFXD3D9Shader::GFXD3D9Shader()
{
....
if( smD3DXInclude == NULL )
smD3DXInclude = new _gfxD3DXInclude; <= this !!
}
<core/volume.cpp>
bool MountSystem::mount(String root,const Path &path)
{
return mount(root, new FileSystemRedirect(this,_normalize(path))); <= this !!
}
<platformWin32/winDLibrary.cpp>
DLibraryRef OsLoadLibrary(const char* file)
{
Win32DLibrary* library = new Win32DLibrary(); <= this !!
....
}
#2
but ~Win32FileSystem() and
~_gfxD3DXInclide() are never called when T3D close.
i know StringRefBase class..
dose it self destroy? :)
08/26/2010 (1:12 pm)
oops~ i am sorry. just i had checked leak by memory tool, that report some memory so i noticed that memory leaks. but ~Win32FileSystem() and
~_gfxD3DXInclide() are never called when T3D close.
i know StringRefBase class..
dose it self destroy? :)
#3
08/26/2010 (4:55 pm)
As far, as I understood, the destructor is called implicitly. I would suggest to take a look in StrongRefBase (or similar) there is a function decref. In decref there should the destruction occur. May be, that the memory tool (Which one are you using?) doesn't recognize the destruction.
#4
08/26/2010 (8:56 pm)
Bug Logged as: TQA-918
#5
It makes sense that filesystem and graphic device are present on the whole program.
08/30/2010 (6:07 am)
I worked with an similar issue on Friday, it seems that destructors are not called on program end, (on performance reasons I assume) so your memory profiler cannot see the call of the destructor. It makes sense that filesystem and graphic device are present on the whole program.
Torque 3D Owner Thomas
mercatronics
FileSystemRef is a self destroying pointer, I would suspect DLibraryRef as a self destroying pointer as well. SMD3DXInclude is also a self destroying pointer.
It took me 2 minutes to investigate it. Have you looked in the code before? Hope you haven´t just make a search on new and delete... ;-)