Discussion:
Memory Leaks
(too old to reply)
g***@googlemail.com
2009-06-07 13:36:51 UTC
Permalink
I am trying to write a graphics engine which uses managed directx and
I have noticed it seems to leak memory like a sieve.

I am confused since managed directx is managed (clue in the name) so
shouldn't it free all its unmanaged resources when my application
terminates? I haven't personally allocated any unmanaged resources,
so when the directx managed classes are finalized they should dispose
and tidy up anything I missed, right?

Viewing the DX debug outputs gives me :

[2968] Direct3D9: (INFO) :MemFini!
[2968] Direct3D9: (WARN) :Memory still allocated! Alloc count = 97
...
[2968] Direct3D9: (WARN) :Total Memory Unfreed From Current Process =
698771 bytes

An after i run my engine a few hundred times in unit tests it busts
DirectX so nothing can use it until a reboot is performed...

What am I missing?

Thanks, G
g***@googlemail.com
2009-06-07 14:17:10 UTC
Permalink
I have added some logging into my code which seems to show that every
DX object I create is later freed and still there is the memory leak

Is there something else I need to free that I am missing?

I have freed all my devices, swap chains, index/vertex buffers and
textures.
legalize+ (Richard [Microsoft Direct3D MVP])
2009-06-07 19:21:47 UTC
Permalink
[Please do not mail me a copy of your followup]
Post by g***@googlemail.com
An after i run my engine a few hundred times in unit tests it busts
DirectX so nothing can use it until a reboot is performed...
There is nothing that should persist after your process has exited.
If your system is leaking resources after a process exits, you have a
driver bug.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>
g***@googlemail.com
2009-06-08 10:24:46 UTC
Permalink
Interesting, thanks for the reply. I will update me drivers and see
if that helps.

I think something is persisting because after a few hundred unit tests
I get an out of video memory exception.
After receiving this error I can no longer run any application that
uses directx.
legalize+ (Richard [Microsoft Direct3D MVP])
2009-06-08 12:42:12 UTC
Permalink
[Please do not mail me a copy of your followup]
Post by g***@googlemail.com
I think something is persisting because after a few hundred unit tests
I get an out of video memory exception.
After receiving this error I can no longer run any application that
uses directx.
Once a process exits, all its resources should be freed. If a process
exits and video memory is no longer available, and you must reboot,
that can only be the fault of the video driver, not the process.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>

Legalize Adulthood! <http://blogs.xmission.com/legalize/>
wee willie wonka
2009-06-09 18:05:02 UTC
Permalink
Post by g***@googlemail.com
I am trying to write a graphics engine which uses managed directx and
I have noticed it seems to leak memory like a sieve.
I am confused since managed directx is managed (clue in the name) so
shouldn't it free all its unmanaged resources when my application
terminates? I haven't personally allocated any unmanaged resources,
so when the directx managed classes are finalized they should dispose
and tidy up anything I missed, right?
[2968] Direct3D9: (INFO) :MemFini!
[2968] Direct3D9: (WARN) :Memory still allocated! Alloc count = 97
....
[2968] Direct3D9: (WARN) :Total Memory Unfreed From Current Process =
698771 bytes
An after i run my engine a few hundred times in unit tests it busts
DirectX so nothing can use it until a reboot is performed...
What am I missing?
Thanks, G
wee willie wonka
2009-06-09 18:06:02 UTC
Permalink
Post by g***@googlemail.com
I am trying to write a graphics engine which uses managed directx and
I have noticed it seems to leak memory like a sieve.
I am confused since managed directx is managed (clue in the name) so
shouldn't it free all its unmanaged resources when my application
terminates? I haven't personally allocated any unmanaged resources,
so when the directx managed classes are finalized they should dispose
and tidy up anything I missed, right?
[2968] Direct3D9: (INFO) :MemFini!
[2968] Direct3D9: (WARN) :Memory still allocated! Alloc count = 97
....
[2968] Direct3D9: (WARN) :Total Memory Unfreed From Current Process =
698771 bytes
An after i run my engine a few hundred times in unit tests it busts
DirectX so nothing can use it until a reboot is performed...
What am I missing?
Thanks, G
jack beebe civil/environmental engineer iz back
Loading...