Changeset 9262 for trunk/src


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

Added code to print leaked heap memory

Location:
trunk/src/kernel32
Files:
2 edited

Legend:

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

    r8898 r9262  
    1 /* $Id: initkernel32.cpp,v 1.22 2002-07-21 09:17:28 sandervl Exp $
     1/* $Id: initkernel32.cpp,v 1.23 2002-09-18 10:58:48 sandervl Exp $
    22 *
    33 * KERNEL32 DLL entry point
     
    222222    return 1UL;
    223223}
    224 
    225 
     224//******************************************************************************
     225//******************************************************************************
    226226void APIENTRY cleanupKernel32(ULONG ulReason)
    227227{
  • 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.