I receive an old project developing with COM and C++, this project throw much exception for the INVALID_POINTER, I guess maybe the pointer is release, but then use this pointer. Is there anyway to check where the memory leak and where the pointer is released?
yu jian
Posts
-
How to fix the invalide pointer problem -
user32!IsWindow crashHello everyone, I meet a crash problem. just as following, I donot know why IsWindow will crash, Is there anyone meet the same problem? AULTING_IP: user32!IsWindow+1a 761a7150 8365fc00 and dword ptr [ebp-4],0 EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 761a7150 (user32!IsWindow+0x0000001a) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000001 Parameter[1]: fffffffc Attempt to write to address fffffffc ChildEBP RetAddr Args to Child 06f9ff48 72d229bb 04e73a50 6928d287 00000000 user32!IsWindow+0x1a 06f9ff80 72d22a47 00000000 7710338a 04e74990 msvcr80!_callthreadstartex+0x1b [f:\sp\vctools\crt_bld\self_x86\crt\src\threadex.c @ 348] 06f9ff88 7710338a 04e74990 06f9ffd4 776b9f72 msvcr80!_threadstartex+0x66 [f:\sp\vctools\crt_bld\self_x86\crt\src\threadex.c @ 326] 06f9ff94 776b9f72 04e74990 70af11ab 00000000 kernel32!BaseThreadInitThunk+0xe 06f9ffd4 776b9f45 72d229e1 04e74990 00000000 ntdll!__RtlUserThreadStart+0x70 06f9ffec 00000000 72d229e1 04e74990 00000000 ntdll!_RtlUserThreadStart+0x1b
-
I need to design a visual design tools for a private GUI library.Because it is difficult and wastes time for modifying the controls position in xml file directly. Is anyone know how to design a good one as visual studio that cat drag and drop controls?
-
How to add the number to the shortcut in the desktop of the application.Yes, I donot know which windows api can do it.
-
How to add the number to the shortcut in the desktop of the application.No, this is changed the shortcut name. I means that display a number in the icon of the shortcut.
-
How to add the number to the shortcut in the desktop of the application.I find some application can show a number in the shutcut in the desktop , but I cannot find which windows api can do it. Is there anyone know it?
-
Dual monitor problem [Solved]I had resolved this problem, Use EnumDisplayMonitors to judge which monitor the application is in. And then set the new maxmium position for the application.
-
Dual monitor problem [Solved]It has two monitor, main and expand monitor. The expand monitor in the top with higher resolution ratio, and the main minitor in the bottom. But if I drag a window to the expand monitor and then double click to show maximium, it has problem, it cannot fill of the windows of the expand monitor? why ? It save the main monitor rectangle info, how to change it.
-
How to let the windows show top most?It needs to let the current process create a copy of process and then exit current process. I try to use the SetWindowPos(m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE) to set windows topmost, when first showup. So I kill the process in the taskmgr.exe and it will notify process to show a modal dialog to let user click, when click and then current process will create new process of itself and then exit current process. So a new process will showup, but I am amazing that why the topmost window is the taskmgr. But if I click the shortcut of this application, and it will show on the topmost. I donot know where is the difference between these ways.
-
How to check if popup a Modal Window?Hi Superman, Perhaps this will meet the recursion problem. And this project only use the C++ not MFC, so if there anyways to use the GetTopWindow or GetLastActivePopup to judge if there is a modal window showing?
-
How to check if popup a Modal Window?I have a application have hte trayIcon with a Close menu, and it needs keep identical with task bar right click menu. But if a Modal window shows, the application cannot be closed if uses [close] menu on the task bar, so I need to check if a modal window is showing, when user click the close menu on the tray icon.
-
what is the usage about _Out_opt_bytecapcount_When say the define of function memcpy, I say it. _CRT_INSECURE_DEPRECATE_MEMORY(memcpy_s) void * __cdecl memcpy(_Out_opt_bytecapcount_(_Size) void * _Dst, _In_opt_bytecount_(_Size) const void * _Src, _In_ size_t _Size); I say the file sal.h, it says that the macro will tell the compile what the usage about this function. but I do not know the compile will do any operation about this macro. If prompt any error when compiling?
-
How to write a Un-fixed size memory pool ?Oh my God. If there have one hundred different size, I will create one hundred memory pool? :(
-
How to write a Un-fixed size memory pool ?I need to optimize my stream player client, it will play 8 road stream in the same time. I think that if use the memory pool, it will help to reduce the usage of time about allocate memory. 30 frames every second, but H264 has I Frame P Frame. So different frames have different size. So the memory pool of boost is not suitable for my client system.
-
why void CView::PostNcDestroy() is called?In a project, I use the CMainFrame* pMainFrame = new CMainFrame() to create a main frame. When the function CMainFrame::OnNcDestroy is called, void CView::PostNcDestroy() will be called. I donot know why CView::PostNcDestroy() will be called, in the function CFrameWnd::OnCreateClient() no new CView is created. Is there anyone know why? Thanks. :(
-
How to write a Un-fixed size memory pool ?I need use the C++ to writer a memory pool to save the frame data, un-fixed size buffer. But I find that the Boost Pool only support allocate the same size memory once a time. So I want to achieve myself memory pool to support saving the not same size frame data. Is there some one meet the similiar problem ?
-
Where does the m_pMainWnd delete?Oh, sorry, I do not use the .net. This is the unmanaged C++. I cannot see where the system delete this pointer in file appcore.cpp. :)
-
Where does the m_pMainWnd delete?I have a client system, to create a CMainFrame object, but I am afraid that there will be memory leak about CMainFrame object.After step in, I cannot find where the m_pMainWnd pointer is deleted. Will I delete this pointer in the function ExitInstance()? :-D
BOOL CApp::InitInstance()
{
CMainFrame* pMainFrame = new CMainFrame();
if (!pMainFrame) return FALSE;
pMainFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
NULL);
m_pMainWnd = pMainFrame;
m_pMainWnd->UpdateWindow();
return TRUE;
}int CApp::ExitInstance()
{
return CWinApp::ExitInstance();
} -
what is the difference between "static" function and "inline" function? [SOLVED]Thank you for you reply.
-
what is the difference between "static" function and "inline" function? [SOLVED]I use the VC++ 2008 to check this question. I define one function named "max2" using keyword "static" and one function named "min2" using keyword "inline". I think that the compiler will use the code inside the min2 function to replace the function called. And the max2 with static keyword will be compiled to be a function. But after the Deassembled in Debug model. I found that the exe both use the "call " assemble code to call these two functions. why does the inline not succeed?