IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 7, 2005, 4:04:22 PM (20 years ago)
Author:
Paul Price
Message:

Using autoconf; some bug fixes to the polynomial order

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/stac/src/stacCheckMemory.c

    r5743 r5745  
    44
    55
    6 #define LEAKS "leaks.dat"               // File to which to write leaks data
     6#define LEAKS "leaks.dat"               // File to which to write leaks data
    77
    88
     
    1010{
    1111    psLogMsg("stac.memoryPrint", PS_LOG_INFO,
    12              "Memory block %d:\n"
    13              "\tFile %s, line %d, size %d\n"
    14              "\tPosts: %x %x %x\n",
    15              ptr->id, ptr->file, ptr->lineno, ptr->userMemorySize, ptr->startblock, ptr->endblock,
    16              *(void**)((int8_t *)(ptr + 1) + ptr->userMemorySize));
     12             "Memory block %d:\n"
     13             "\tFile %s, line %d, size %d\n"
     14             "\tPosts: %x %x %x\n",
     15             ptr->id, ptr->file, ptr->lineno, ptr->userMemorySize, ptr->startblock, ptr->endblock,
     16             *(void**)((int8_t *)(ptr + 1) + ptr->userMemorySize));
    1717    return 0;
    1818}
     
    2020
    2121void stacMemoryProblem(const psMemBlock* ptr, ///< the pointer to the problematic memory block.
    22                        const char *file, ///< the file in which the problem originated
    23                        psS32 lineno     ///< the line number in which the problem originated
     22                       const char *file, ///< the file in which the problem originated
     23                       psS32 lineno     ///< the line number in which the problem originated
    2424    )
    2525{
    2626    psLogMsg("stac.checkMemory.corruption", PS_LOG_WARN,
    27              "Memory corruption detected in memBlock %d\n"
    28              "\tFile %s, line %d, size %d\n"
    29              "\tPosts: %x %x %x\n",
    30              ptr->id, file, lineno, ptr->userMemorySize, ptr->startblock, ptr->endblock,
    31              (ptr + 1 + ptr->userMemorySize));
     27             "Memory corruption detected in memBlock %d\n"
     28             "\tFile %s, line %d, size %d\n"
     29             "\tPosts: %x %x %x\n",
     30             ptr->id, file, lineno, ptr->userMemorySize, ptr->startblock, ptr->endblock,
     31             (ptr + 1 + ptr->userMemorySize));
    3232}
    3333
     
    3636void stacCheckMemory(void)
    3737{
    38     psMemBlock **leaks = NULL;          // List of leaks
    39     FILE *leakFile;                     // File to write leaks to
     38    psMemBlock **leaks = NULL;          // List of leaks
     39    FILE *leakFile;                     // File to write leaks to
    4040
    4141    psTrace("stac.checkMemory", 1, "Checking for memory problems....\n");
     
    4444
    4545    if ((leakFile = fopen(LEAKS, "w")) == NULL) {
    46         fprintf(stderr, "Unable to open leaks file, %s\n", LEAKS);
    47         return;
     46        fprintf(stderr, "Unable to open leaks file, %s\n", LEAKS);
     47        return;
    4848    }
    4949
     
    5151    psTrace("stac.checkMemory", 1, "%d leaks found.\n", nLeaks);
    5252    for (int i = 0; i < nLeaks; i++) {
    53         psLogMsg("stac.checkMemory.leaks", PS_LOG_WARN,
    54                 "Memory leak detection: memBlock %d\n"
    55                 "\tFile %s, line %d, size %d\n",
    56                 leaks[i]->id, leaks[i]->file, leaks[i]->lineno, leaks[i]->userMemorySize);
     53        psLogMsg("stac.checkMemory.leaks", PS_LOG_WARN,
     54                "Memory leak detection: memBlock %d\n"
     55                "\tFile %s, line %d, size %d\n",
     56                leaks[i]->id, leaks[i]->file, leaks[i]->lineno, leaks[i]->userMemorySize);
    5757    }
    5858
    59     int nCorrupted = psMemCheckCorruption(false); // Number of corrupted
     59    int nCorrupted;                     // Number of corrupted memory blocks
     60    nCorrupted = psMemCheckCorruption(false);
    6061    psTrace("stac.checkMemory", 1, "%d memory blocks corrupted.\n", nCorrupted);
    6162
Note: See TracChangeset for help on using the changeset viewer.