Changeset 8956


Ignore:
Timestamp:
Mar 30, 2008, 8:06:40 AM (11 years ago)
Author:
gb
Message:

Define DEBUG_MEMORY, suppress debugging progress messages unless it's
non-zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/win64/lisp-kernel/memory.c

    r8790 r8956  
    3838#endif
    3939
     40#define DEBUG_MEMORY 0
     41
    4042void
    4143allocation_failure(Boolean pointerp, natural size)
     
    207209  mprotect(start, totalsize, PROT_NONE);
    208210#endif
     211#if DEBUG_MEMORY
    209212  fprintf(stderr, "Reserving heap at 0x%Ix, size 0x%Ix\n", start, totalsize);
     213#endif
    210214  return start;
    211215}
     
    214218CommitMemory (LogicalAddress start, natural len) {
    215219  LogicalAddress rc;
     220#if DEBUG_MEMORY
    216221  fprintf(stderr, "Committing memory at 0x%Ix, size 0x%Ix\n", start, len);
     222#endif
    217223#ifdef WINDOWS
    218224  rc = VirtualAlloc(start, len, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
     
    240246void
    241247UnCommitMemory (LogicalAddress start, natural len) {
     248#if DEBUG_MEMORY
    242249  fprintf(stderr, "Uncommitting memory at 0x%Ix, size 0x%Ix\n", start, len);
     250#endif
    243251#ifdef WINDOWS
    244252  int rc = VirtualFree(start, len, MEM_DECOMMIT);
     
    265273MapMemory(LogicalAddress addr, natural nbytes, int protection)
    266274{
     275#if DEBUG_MEMORY
    267276  fprintf(stderr, "Mapping memory at 0x%Ix, size 0x%Ix\n", addr, nbytes);
     277#endif
    268278#ifdef WINDOWS
    269279  return VirtualAlloc(addr, nbytes, MEM_RESERVE|MEM_COMMIT, MEMPROTECT_RWX);
     
    276286MapMemoryForStack(natural nbytes)
    277287{
     288#if DEBUG_MEMORY
    278289  fprintf(stderr, "Mapping stack of size 0x%Ix\n", nbytes);
     290#endif
    279291#ifdef WINDOWS
    280292  return VirtualAlloc(0, nbytes, MEM_RESERVE|MEM_COMMIT, MEMPROTECT_RWX);
     
    287299UnMapMemory(LogicalAddress addr, natural nbytes)
    288300{
     301#if DEBUG_MEMORY
    289302  fprintf(stderr, "Unmapping memory at 0x%Ix, size 0x%Ix\n", addr, nbytes);
     303#endif
    290304#ifdef WINDOWS
    291305  /* Can't MEM_RELEASE here because we only want to free a chunk */
     
    299313ProtectMemory(LogicalAddress addr, natural nbytes)
    300314{
     315#if DEBUG_MEMORY
    301316  fprintf(stderr, "Protecting memory at 0x%Ix, size 0x%Ix\n", addr, nbytes);
     317#endif
    302318#ifdef WINDOWS
    303319  DWORD oldProtect;
     
    323339UnProtectMemory(LogicalAddress addr, natural nbytes)
    324340{
     341#if DEBUG_MEMORY
    325342  fprintf(stderr, "Unprotecting memory at 0x%Ix, size 0x%Ix\n", addr, nbytes);
     343#endif
    326344#ifdef WINDOWS
    327345  DWORD oldProtect;
Note: See TracChangeset for help on using the changeset viewer.