Quantcast
Channel: Visual Leak Detector for Visual C++ 2008-2015
Viewing all articles
Browse latest Browse all 704

Edited Unassigned: R6010 - abort() has been called [10575]

$
0
0
Without vld, no error.
With vld, when program is exiting, R6010 error is raised.
From the call stack below, it happens when g_vld destructor is called,

[Source line for R6010 error]
void __cdecl _NMSG_WRITE (
int rterrnum
)
{
const wchar_t * const error_text = _GET_RTERRMSG(rterrnum);

if (error_text)
{
int msgshown = 0;
#ifdef _DEBUG
/*
* Report error.
*
* If _CRT_ERROR has _CRTDBG_REPORT_WNDW on, and user chooses
* "Retry", call the debugger.
*
* Otherwise, continue execution.
*
*/

if (rterrnum != _RT_CRNL && rterrnum != _RT_BANNER && rterrnum != _RT_CRT_NOTINIT)
{
switch (_CrtDbgReportW(_CRT_ERROR, NULL, 0, NULL, error_text)) // erro_text is 'R6010 - abort() has been called'
{
case 1: _CrtDbgBreak(); msgshown = 1; break;
case 0: msgshown = 1; break;
}
}
#endif /* _DEBUG */
if (!msgshown)
{
if ( (_set_error_mode(_REPORT_ERRMODE) == _OUT_TO_STDERR) ||
((_set_error_mode(_REPORT_ERRMODE) == _OUT_TO_DEFAULT) &&
(__app_type == _CONSOLE_APP)) )
{
HANDLE hStdErr = GetStdHandle(STD_ERROR_HANDLE);
if (hStdErr && hStdErr != INVALID_HANDLE_VALUE)
{
/*
* This purposely truncates wchar_t to char.
* error_text doesn't contain the application's name.
* Currently, error_text contains only ASCII,
* so this truncation preserves VC9's behavior.
* If error_text is ever localized, this will have to be changed.
*
*/

char buffer[500];
int i;
DWORD bytes_written;

for (i = 0; i < _countof(buffer); ++i)
{
buffer[i] = (char) error_text[i];

if (error_text[i] == L'\0')
{
break;
}
}

buffer[_countof(buffer) - 1] = '\0';

WriteFile( hStdErr,
buffer,
(unsigned long)strlen(buffer),
&bytes_written,
NULL );
}
}
else if (rterrnum != _RT_CRNL)
{
#define MSGTEXTPREFIX L"Runtime Error!\n\nProgram: "
static wchar_t outmsg[sizeof(MSGTEXTPREFIX) / sizeof(wchar_t) + _MAX_PATH + 2 + 500];
// runtime error msg + progname + 2 newline + runtime error text.
wchar_t * progname = &outmsg[sizeof(MSGTEXTPREFIX) / sizeof(wchar_t) - 1];
size_t progname_size = _countof(outmsg) - (progname - outmsg);
wchar_t * pch = progname;

_ERRCHECK(wcscpy_s(outmsg, _countof(outmsg), MSGTEXTPREFIX));

progname[MAX_PATH] = L'\0';
if (!GetModuleFileNameW(NULL, progname, MAX_PATH))
_ERRCHECK(wcscpy_s(progname, progname_size, L"<program name unknown>"));

#define MAXLINELEN 60
if (wcslen(pch) + 1 > MAXLINELEN)
{
pch += wcslen(progname) + 1 - MAXLINELEN;
_ERRCHECK(wcsncpy_s(pch, progname_size - (pch - progname), L"...", 3));
}

_ERRCHECK(wcscat_s(outmsg, _countof(outmsg), L"\n\n"));
_ERRCHECK(wcscat_s(outmsg, _countof(outmsg), error_text));

__crtMessageBoxW(outmsg,
L"Microsoft Visual C++ Runtime Library",
MB_OK|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);
}
}
}
}


[When R6010 raised, Debug output window shows]
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 332 at 0x00000000005C1350: 256 bytes ----------

[And below is from Call stack window when R6010 happened]
vld_x64.dll!_NMSG_WRITE(int rterrnum=0x0000000a) Line 217
vld_x64.dll!abort() Line 71
vld_x64.dll!_wassert(const wchar_t * expr=0x00000000032ea908, const wchar_t * filename=0x00000000032ea828, unsigned int lineno=0x00000633) Line 336
vld_x64.dll!VisualLeakDetector::reportLeaks(heapinfo_t * heapinfo=0x0000000002496850, bool & firstLeak=false, Set<blockinfo_t *> & aggregatedLeaks={...}, unsigned long threadId=0xffffffff) Line 1587 + 0x28 bytes
vld_x64.dll!VisualLeakDetector::ReportLeaks() Line 2041 + 0x2a bytes
vld_x64.dll!VisualLeakDetector::~VisualLeakDetector() Line 426 + 0xd bytes
vld_x64.dll!`dynamic atexit destructor for 'g_vld''() + 0x21 bytes
vld_x64.dll!doexit(int code=0x00000000, int quick=0x00000000, int retcaller=0x00000001) Line 567
vld_x64.dll!_cexit() Line 409
vld_x64.dll!_CRT_INIT(void * hDllHandle=0x0000000003200000, unsigned long dwReason=0x00000000, void * lpreserved=0x0000000000000001) Line 181
vld_x64.dll!__DllMainCRTStartup(void * hDllHandle=0x0000000003200000, unsigned long dwReason=0x00000000, void * lpreserved=0x0000000000000001) Line 352 + 0x13 bytes
vld_x64.dll!_DllMainCRTStartup(void * hDllHandle=0x0000000003200000, unsigned long dwReason=0x00000000, void * lpreserved=0x0000000000000001) Line 294
ntdll.dll!00000000770343a1()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]

HaeRim





Viewing all articles
Browse latest Browse all 704

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>