LoadImage() memory leak.
-
Hi, In my application i have this: HBITMAP hImage; hImage = (HBITMAP)::LoadImage (AfxGetInstanceHandle(), "c:\\TEMP.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE |LR_CREATEDIBSECTION ); DeleteObject(hImage); These statement will increase the memory usage by 28 KB. Size of the "temp.bmp" file is 360KB. Could any one tell me why is it so? Regards Neha
-
Hi, In my application i have this: HBITMAP hImage; hImage = (HBITMAP)::LoadImage (AfxGetInstanceHandle(), "c:\\TEMP.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE |LR_CREATEDIBSECTION ); DeleteObject(hImage); These statement will increase the memory usage by 28 KB. Size of the "temp.bmp" file is 360KB. Could any one tell me why is it so? Regards Neha
Neha wrote: These statement will increase the memory usage by 28 KB. How are you measuring this?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Hi, In my application i have this: HBITMAP hImage; hImage = (HBITMAP)::LoadImage (AfxGetInstanceHandle(), "c:\\TEMP.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE |LR_CREATEDIBSECTION ); DeleteObject(hImage); These statement will increase the memory usage by 28 KB. Size of the "temp.bmp" file is 360KB. Could any one tell me why is it so? Regards Neha
this is not the answer to your question, but for loading a bitmap from the disk, you dont need to pass the hInst to the function! Don't try it, just do it! ;-)
-
Neha wrote: These statement will increase the memory usage by 28 KB. How are you measuring this?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
this is not the answer to your question, but for loading a bitmap from the disk, you dont need to pass the hInst to the function! Don't try it, just do it! ;-)
-
the value displayed in the task manager is not correct at all! Don't try it, just do it! ;-)
-
the value displayed in the task manager is not correct at all! Don't try it, just do it! ;-)
-
The best you could hope to come from TM is to show the size of the address space that is in use, not the amount of that address space that your program is actually using. Perhaps you are confusing address space with program size.
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Still no difference.. One more strange thing is when some of function been called, It will increase the memory usage by 4KB.Those function don't allocate anything......
Neha wrote: One more strange thing is when some of function been called, It will increase the memory usage by 4KB.Those function don't allocate anything...... How do you know? When you call a function that is not your own, are you sure of what it does, or doesn't do, behind the scene?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
The best you could hope to come from TM is to show the size of the address space that is in use, not the amount of that address space that your program is actually using. Perhaps you are confusing address space with program size.
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Hi, In my application i have this: HBITMAP hImage; hImage = (HBITMAP)::LoadImage (AfxGetInstanceHandle(), "c:\\TEMP.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE |LR_CREATEDIBSECTION ); DeleteObject(hImage); These statement will increase the memory usage by 28 KB. Size of the "temp.bmp" file is 360KB. Could any one tell me why is it so? Regards Neha
-
If you execute that code 100 times does it increase the memory in task manager by 2800 K? If yes, then it is a memory leak. If no, it is just increasing the process address space one time to reflect the additional library code you used.
-
Hi, In my application i have this: HBITMAP hImage; hImage = (HBITMAP)::LoadImage (AfxGetInstanceHandle(), "c:\\TEMP.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE |LR_CREATEDIBSECTION ); DeleteObject(hImage); These statement will increase the memory usage by 28 KB. Size of the "temp.bmp" file is 360KB. Could any one tell me why is it so? Regards Neha