Archived

This topic is now archived and is closed to further replies.

Memory Leaks problem

This topic is 5513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, once again i need some help So here goes, im atm doing a tetris following teej tutorials, my prog is not done yet but when i debug it i get that in the output window: Direct3D8: (ERROR) :Memory still allocated! Alloc count = 32 Direct3D8: (ERROR) :Current Process (pid) = 0000010c Direct3D8: (ERROR) :Memory Address: 002f3fec lAllocID=17 dwSize=00000bb0, ReturnAddr=51037886 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f4c1c lAllocID=20 dwSize=00000168, ReturnAddr=51037ad1 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f532c lAllocID=23 dwSize=0000001c, ReturnAddr=51034647 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f5384 lAllocID=24 dwSize=00000018, ReturnAddr=51034678 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f53dc lAllocID=25 dwSize=00000080, ReturnAddr=51035175 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f54dc lAllocID=27 dwSize=00000074, ReturnAddr=510385f1 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f560c lAllocID=29 dwSize=0000000c, ReturnAddr=51038857 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f56bc lAllocID=31 dwSize=00000034, ReturnAddr=510354ba (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f5724 lAllocID=32 dwSize=00000034, ReturnAddr=51035501 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f578c lAllocID=33 dwSize=00000024, ReturnAddr=51035874 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f57e4 lAllocID=34 dwSize=00000024, ReturnAddr=510358ce (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f583c lAllocID=35 dwSize=00000024, ReturnAddr=51035905 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f5894 lAllocID=37 dwSize=0000042c, ReturnAddr=51021d47 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f5cfc lAllocID=38 dwSize=0000042c, ReturnAddr=51021d5c (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f6164 lAllocID=39 dwSize=00000208, ReturnAddr=5101cd75 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f63ac lAllocID=40 dwSize=00000208, ReturnAddr=5101cd75 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f65f4 lAllocID=41 dwSize=00000208, ReturnAddr=5101cd75 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f683c lAllocID=42 dwSize=00000208, ReturnAddr=5101cd75 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f6a84 lAllocID=43 dwSize=00000208, ReturnAddr=5101cd75 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f6ccc lAllocID=44 dwSize=00000208, ReturnAddr=5101cd75 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f6f14 lAllocID=45 dwSize=000000c4, ReturnAddr=51035dda (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f28dc lAllocID=47 dwSize=00000018, ReturnAddr=51057340 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f529c lAllocID=48 dwSize=00000024, ReturnAddr=5103d6cd (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f726c lAllocID=60 dwSize=00000a00, ReturnAddr=51022bfa (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f805c lAllocID=69 dwSize=00000050, ReturnAddr=5105c32b (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f80e4 lAllocID=70 dwSize=00000400, ReturnAddr=5105c384 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f851c lAllocID=71 dwSize=00000018, ReturnAddr=5105af10 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f8574 lAllocID=72 dwSize=00000004, ReturnAddr=5105ae3b (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f4dc4 lAllocID=88 dwSize=000004a4, ReturnAddr=51037b2a (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f5494 lAllocID=90 dwSize=00000010, ReturnAddr=5103857f (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f5584 lAllocID=91 dwSize=00000048, ReturnAddr=510387a0 (pid=0000010c) Direct3D8: (ERROR) :Memory Address: 002f5654 lAllocID=92 dwSize=00000034, ReturnAddr=51035494 (pid=0000010c) Direct3D8: (ERROR) :Total Memory Unfreed From Current Process = 14404 bytes So im assuming its a surface or something i forgot to unload ? anyone can give me any help? or point me in a direction of some tutorials how to find memory leaks? thx in advance Leo "The bible is probably the most genocidal book ever written!" Noam Chomsky

Share this post


Link to post
Share on other sites
1) You''re using the debug runtime and checking the output which is a Good Thing.

2) Make a note of the lAllocID values, then go to the control panel, to the DirectX applet then to the D3D settings. You''ll see a thing called "break on allocID" - enter some of the allocation numbers in there.

3) Next run your program in the debugger and as soon as the thing which wasn''t released is **allocated**, then you should get a breakpoint in the debugger. You can look down the callstack in the debugger to get to the point in your code which made the allocation.

That should help you find which object isn''t being properly released.

Remember that any D3D Get* calls which return an interface will increment the reference count for that interface (see the part of the D3D docs about how COM reference counting works)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Wow thanks a lot that was very clear and i didnt know you could do that, well there is just a small prob sorry i didnt mention earlier, im using directdraw and not d3d, is there a way to find out the leaks with DDraw? i went in the control pannel but there does not seems to be anything the same. While im at it, im using Directx 7.0 in my code but i've got 8.0 on my comp.

"The bible is probably the most genocidal book ever written!" Noam Chomsky

[edited by - Le0 on November 7, 2002 10:26:28 AM]

Share this post


Link to post
Share on other sites
I *think* the same "break on allocID" should still work because the errors you posted were produced by D3D8 so DirectDraw 7 is probably just calling down to that to handle things surfaces under the covers.

The callstack would probably still be able to track back to your application, something like (totally hypothetical library names similar to the callstack I''ve seen in my own applications):

!NTDLL
!D3D8DLL
!DD7
YourApp::Blah
YourApp
main()
0x8171528

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
ok well, when i try putting something in AllocID i get an error that while windows was working on system32\directx.cpl of the control pannel an error happened and the DxApplet closes.
Also is there a use for DDraw for Break on memory leaks?

"The bible is probably the most genocidal book ever written!" Noam Chomsky

Share this post


Link to post
Share on other sites
I found out what was my leak its because i forgot to release the LPDIRECTDRAWPALETTE but im not sure how i do it anyone can help ?

"The bible is probably the most genocidal book ever written!" Noam Chomsky

Share this post


Link to post
Share on other sites