Ignore:
Timestamp:
Sep 18, 2002, 12:58:48 PM (23 years ago)
Author:
sandervl
Message:

Added code to print leaked heap memory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/wprocess.cpp

    r8952 r9262  
    1 /* $Id: wprocess.cpp,v 1.158 2002-08-01 16:02:41 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.159 2002-09-18 10:58:48 sandervl Exp $ */
    22
    33/*
     
    471471//******************************************************************************
    472472//******************************************************************************
     473//#define DEBUG_HEAPSTATE
     474#ifdef DEBUG_HEAPSTATE
     475char *pszHeapDump      = NULL;
     476char *pszHeapDumpStart = NULL;
     477
     478int _LNK_CONV callback_function(const void *pentry, size_t sz, int useflag, int status,
     479                                const char *filename, size_t line)
     480{
     481    if (_HEAPOK != status) {
     482//       dprintf(("status is not _HEAPOK."));
     483       return 1;
     484    }
     485    if (_USEDENTRY == useflag && sz && filename && line && pszHeapDump) {
     486       sprintf(pszHeapDump, "allocated  %08x %u at %s %d\n", pentry, sz, filename, line);
     487       pszHeapDump += strlen(pszHeapDump);
     488    }
     489
     490    return 0;
     491}
     492//******************************************************************************
     493//******************************************************************************
     494#endif
    473495VOID WIN32API ExitProcess(DWORD exitcode)
    474496{
     
    517539    }
    518540    threadListMutex.leave();
     541
     542#ifdef DEBUG_HEAPSTATE
     543    pszHeapDumpStart = pszHeapDump = (char *)malloc(10*1024*1024);
     544    _heap_walk(callback_function);
     545    dprintf((pszHeapDumpStart));
     546    free(pszHeapDumpStart);
     547#endif
    519548
    520549#ifdef PROFILE
Note: See TracChangeset for help on using the changeset viewer.