Exemple #1
0
void DBMemLeak::Alloc(const void* result, const char* query) {
	LockMutex lock(&MDBMemLeak);
	long requestNumber;
	uint8* tmp2 = new uint8;
	_CrtIsMemoryBlock( tmp2, 1, &requestNumber, 0, 0 );
	safe_delete(tmp2);
	DBMemLeakStruct* tmp = (DBMemLeakStruct*) new uchar[sizeof(DBMemLeakStruct) + strlen(query) + 1];
	tmp->result = result;
	tmp->memblock = requestNumber;
	strcpy(tmp->query, query);
	list->Append(tmp);
}
// for persistent command processors, send a command that will terminate cmd.exe
// typically this will be called before the main app exits
void CConsolePipe::StopCmd() {
	assert(CPF_REUSECMDPROC & m_dwFlags);
	assert( // assume normal "new"
		_CrtIsMemoryBlock(this, sizeof(CConsolePipe), 0,0,0) &&
		IsBadReadPtr(this, sizeof(CConsolePipe))==0);

	if(IsChildRunning()) {
		SendCtrlBrk(); // in case it was stuck

		if( (CPF_REUSECMDPROC & m_dwFlags) ) {
			//SendChildInput(^Z) would help stop some blocked processors
			Execute(_T("exit"));
			Sleep(200);
			// cleanup will occur "naturally"
		}
	}
}
Exemple #3
0
// -- true if block of exact size, allocated on the heap
// -- set *plRequestNumber to request number (or 0)
BOOL AFXAPI AfxIsMemoryBlock(const void* pData, UINT nBytes,
		LONG* plRequestNumber)
{
	return _CrtIsMemoryBlock(pData, nBytes, plRequestNumber, NULL, NULL);
}