Heap corruption problem after AfxBeginThread?
-
Hi, i need some help to solve this problem after create of worker thread. When i create a worker thread i receive this error message:
Windows has triggered a breakpoint in myprog.exe.
This may be due to a corruption of the heap, which indicates a bug in myprog.exe or any of the DLLs it has loaded.
This is the code snippet:
// create Thread:
CWinThread* cmythr= AfxBeginThread(controlfunc,params, THREAD_PRIORITY_HIGHEST, 0,CREATE_SUSPENDED,0);
if(NULL != cmythr)
{
cmythr->ResumeThread();
}but after maybe 10 seconds i receive this error message: and the debugger show in this code in the file thrdcore.cpp:
// first -- check for simple worker thread
DWORD nResult = 0;
if (pThread->m_pfnThreadProc != NULL)
{
nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);
ASSERT_VALID(pThread);
}A thing what make me confuse is that i cant find this position with memory allocation, i do nothing like this in this Function? No parameter is NULL, what i'm doing wrong? Any help is welcome Thanks bosfan
-
Hi, i need some help to solve this problem after create of worker thread. When i create a worker thread i receive this error message:
Windows has triggered a breakpoint in myprog.exe.
This may be due to a corruption of the heap, which indicates a bug in myprog.exe or any of the DLLs it has loaded.
This is the code snippet:
// create Thread:
CWinThread* cmythr= AfxBeginThread(controlfunc,params, THREAD_PRIORITY_HIGHEST, 0,CREATE_SUSPENDED,0);
if(NULL != cmythr)
{
cmythr->ResumeThread();
}but after maybe 10 seconds i receive this error message: and the debugger show in this code in the file thrdcore.cpp:
// first -- check for simple worker thread
DWORD nResult = 0;
if (pThread->m_pfnThreadProc != NULL)
{
nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);
ASSERT_VALID(pThread);
}A thing what make me confuse is that i cant find this position with memory allocation, i do nothing like this in this Function? No parameter is NULL, what i'm doing wrong? Any help is welcome Thanks bosfan
Answer these two questions. 1) Provide the prototype of your function controlfunc> 2) What do you pass as params?
-
Hi, i need some help to solve this problem after create of worker thread. When i create a worker thread i receive this error message:
Windows has triggered a breakpoint in myprog.exe.
This may be due to a corruption of the heap, which indicates a bug in myprog.exe or any of the DLLs it has loaded.
This is the code snippet:
// create Thread:
CWinThread* cmythr= AfxBeginThread(controlfunc,params, THREAD_PRIORITY_HIGHEST, 0,CREATE_SUSPENDED,0);
if(NULL != cmythr)
{
cmythr->ResumeThread();
}but after maybe 10 seconds i receive this error message: and the debugger show in this code in the file thrdcore.cpp:
// first -- check for simple worker thread
DWORD nResult = 0;
if (pThread->m_pfnThreadProc != NULL)
{
nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);
ASSERT_VALID(pThread);
}A thing what make me confuse is that i cant find this position with memory allocation, i do nothing like this in this Function? No parameter is NULL, what i'm doing wrong? Any help is welcome Thanks bosfan
It's impossible to guess what may be wrong with the information you provided. You should use your debugger to set some breakpoints in your code, and check the actual values of the various parameters at the time of the failure. You can also use the stacktrace to see which functions have been called recently.
One of these days I'm going to think of a really clever signature.
-
It's impossible to guess what may be wrong with the information you provided. You should use your debugger to set some breakpoints in your code, and check the actual values of the various parameters at the time of the failure. You can also use the stacktrace to see which functions have been called recently.
One of these days I'm going to think of a really clever signature.
-
Hi, i need some help to solve this problem after create of worker thread. When i create a worker thread i receive this error message:
Windows has triggered a breakpoint in myprog.exe.
This may be due to a corruption of the heap, which indicates a bug in myprog.exe or any of the DLLs it has loaded.
This is the code snippet:
// create Thread:
CWinThread* cmythr= AfxBeginThread(controlfunc,params, THREAD_PRIORITY_HIGHEST, 0,CREATE_SUSPENDED,0);
if(NULL != cmythr)
{
cmythr->ResumeThread();
}but after maybe 10 seconds i receive this error message: and the debugger show in this code in the file thrdcore.cpp:
// first -- check for simple worker thread
DWORD nResult = 0;
if (pThread->m_pfnThreadProc != NULL)
{
nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);
ASSERT_VALID(pThread);
}A thing what make me confuse is that i cant find this position with memory allocation, i do nothing like this in this Function? No parameter is NULL, what i'm doing wrong? Any help is welcome Thanks bosfan
-
Hi, i need some help to solve this problem after create of worker thread. When i create a worker thread i receive this error message:
Windows has triggered a breakpoint in myprog.exe.
This may be due to a corruption of the heap, which indicates a bug in myprog.exe or any of the DLLs it has loaded.
This is the code snippet:
// create Thread:
CWinThread* cmythr= AfxBeginThread(controlfunc,params, THREAD_PRIORITY_HIGHEST, 0,CREATE_SUSPENDED,0);
if(NULL != cmythr)
{
cmythr->ResumeThread();
}but after maybe 10 seconds i receive this error message: and the debugger show in this code in the file thrdcore.cpp:
// first -- check for simple worker thread
DWORD nResult = 0;
if (pThread->m_pfnThreadProc != NULL)
{
nResult = (*pThread->m_pfnThreadProc)(pThread->m_pThreadParams);
ASSERT_VALID(pThread);
}A thing what make me confuse is that i cant find this position with memory allocation, i do nothing like this in this Function? No parameter is NULL, what i'm doing wrong? Any help is welcome Thanks bosfan
Try enabling the "page heap" for your application. It can be a little painful but it often finds the cause of problems like yours.
Steve