问题描述
在我的项目中,我从未对任何操作使用新的delete malloc calloc.
我只使用过一次new运算符即可在winmain()&中创建xyz类的对象.退出项目时释放该对象.
我在应用程序中使用了vmr,vfw,gdi gdi plus,icon而不是普通按钮
播放每个新视频后,内存增加(在任务管理器中)
甚至当我移动鼠标或单击鼠标左键时,mem也会增加
我应该如何查找是否有内存泄漏.
当光标移动到任意两个图标(HOME& EXIT)时,以下代码用于文本显示
In my project i never used new delete malloc calloc for any operation.
i used new operator only once to create object of xyz class in winmain() & free that object while exiting the project.
i had use vmr, vfw, gdi gdi plus ,icon instead of normal button in my application
after playing each new video memory is increases( in task manager)
even some times when i move mouse or click left button mem increases
how should i find is there any memory leak.
below code is used to textual display when cursor is move to any two icon(HOME & EXIT)
case WM_MOUSEMOVE:
{
HWND hwButton_home=GetDlgItem(g_hDialogWindow,IDC_ICON_HOME);
HWND hwButton_exit=GetDlgItem(g_hDialogWindow,IDC_ICON_EXIT);
WINDOWPLACEMENT lpwndpl_home;
WINDOWPLACEMENT lpwndpl_exit;
GetWindowPlacement(hwButton_home,&lpwndpl_home);
GetWindowPlacement(hwButton_analyze,&lpwndpl_exit);
if( ((lpwndpl_home.rcNormalPosition.left)<LOWORD(lParam)&& LOWORD(lParam)<(lpwndpl_home.rcNormalPosition.right)) && ((lpwndpl_home.rcNormalPosition.top)<HIWORD(lParam)&& HIWORD(lParam)<(lpwndpl_home.rcNormalPosition.bottom)))
{
if(IsWindowEnabled(hwButton_home))
{
::SetWindowPos(GetDlgItem(g_hDialogWindow, IDC_MODE_TEXT), HWND_NOTOPMOST, lpwndpl_home.rcNormalPosition.left, lpwndpl_home.rcNormalPosition.bottom, 45,18, SWP_NOZORDER);
SetWindowText(GetDlgItem(g_hDialogWindow, IDC_MODE_TEXT), "HOME");
ShowWindow(GetDlgItem(g_hDialogWindow, IDC_MODE_TEXT), TRUE);
}
}
else if( ((lpwndpl_exit.rcNormalPosition.left)<LOWORD(lParam)&& LOWORD(lParam)<(lpwndpl_exit.rcNormalPosition.right)) && ((lpwndpl_exit.rcNormalPosition.top)<HIWORD(lParam)&& HIWORD(lParam)<(lpwndpl_exit.rcNormalPosition.bottom)))
{
if(IsWindowEnabled(hwButton_exit))
{
::SetWindowPos(GetDlgItem(g_hDialogWindow, IDC_MODE_TEXT), HWND_NOTOPMOST, lpwndpl_exit.rcNormalPosition.left+5, lpwndpl_exit.rcNormalPosition.bottom, 75,18, SWP_NOZORDER);
SetWindowText(GetDlgItem(g_hDialogWindow, IDC_MODE_TEXT), "EXIT");
ShowWindow(GetDlgItem(g_hDialogWindow, IDC_MODE_TEXT), TRUE);
}
}
else
ShowWindow(GetDlgItem(g_hDialogWindow, IDC_MODE_TEXT), FALSE);
}
break;
当我将鼠标放在该图标上时,meme会增加4个字节.
when i placed mouse on this icon 4 bytes of meme increases.
推荐答案
这篇关于内存泄漏win32(除了新的免费删除malloc之外)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!