Maybe errors in the lesson 35

Started by
1 comment, last by Captain Zurg 17 years, 6 months ago
Hi all, i copy paste the e-mail i wrote for nehe@cruzinternet.com I'm creating a myst-like game, so i was really happy when i found your tutorial which is really good. But after i move in my world in the game, the pc memory didn't go back ( sorry, i'm french so i've a difficult english ). So i search in my program, but all seem to be alright, and this problem occured when i use my Class AVIVideo. So, i'm not sure but your variable HDC hdc = CreateCompatibleDC(0); create a space in the memory and when you close your Avi File, you don't free this memory. So i add in my destructor DeleteObject(hdc); and it's work good now. I wish it will help you :) and thanks again for your help with your tutorial :) i forget to tell you that in roder to read xvid avi file, you must in the line pgf=AVIStreamGetFrameOpen(pavi, NULL); replace NULL by the following structure ( source : http://forum.doom9.org/archive/index.php/t-69601.html ) tagBITMAPINFOHEADER *patch_xvid=new tagBITMAPINFOHEADER; patch_xvid->biBitCount=24; patch_xvid->biSize=sizeof(BITMAPINFOHEADER); patch_xvid->biWidth=352; patch_xvid->biHeight=480; patch_xvid->biPlanes=1; patch_xvid->biCompression=BI_RGB; Thanks you again :) Yours sincerly, Captain Zurg http://www.myst-universe.net/
Advertisement
I havn't tinkered with lesson 35 yet, but if it's just about memory management it might not be an actual error.
What OS you running, XP? In extreme basic terms:

Just check, with a real memory manager, that the memory is actually getting freed. Windows Task Manager, and well Windows for that matter, lies to you about how much memory is being used, and how much memory is REALLY being used.

Windows doesn't exactly free data when you tell it, it only truly frees unused data when it's no longer needed, or if you force it to free memory.
For my test, i load a movie, i played this movie and then i delete my object.
i do this operation 10 times and the memory which is not free is about 700KB each time
So i searched in the code and when i delete this object, this 700KB disappear.

Si i suppose that this object hdc must be deleted :) i'm not sure of course, but maybe it's an error...
i'm sorry if i'm in false :(

i use Windows XP.



[Edited by - Captain Zurg on October 4, 2006 6:47:04 AM]

This topic is closed to new replies.

Advertisement