Changeset 5951956 for libcfa/src


Ignore:
Timestamp:
Oct 13, 2022, 9:59:31 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
a25bcf8
Parents:
7671c6d
Message:

fix 32-bit problemgenrating spurious unfreed-storage message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    r7671c6d r5951956  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 12 18:06:01 2022
    13 // Update Count     : 1528
     12// Last Modified On : Thu Oct 13 21:41:32 2022
     13// Update Count     : 1553
    1414//
    1515
     
    515515                } // with
    516516        } // if
     517
    517518        return heap;
    518519} // getHeap
     
    585586                // allocUnfreed is set to 0 when a heap is created and it accumulates any unfreed storage during its multiple thread
    586587                // usages.  At the end, add up each heap allocUnfreed value across all heaps to get the total unfreed storage.
    587                 long long int allocUnfreed = 0;
     588                int64_t allocUnfreed = 0;
    588589                for ( Heap * heap = heapMaster.heapManagersList; heap; heap = heap->nextHeapManager ) {
    589590                        allocUnfreed += heap->allocUnfreed;
     
    10421043                        if ( errno == ENOMEM ) abort( NO_MEMORY_MSG, tsize ); // no memory
    10431044                        // Do not call strerror( errno ) as it may call malloc.
    1044                         abort( "attempt to allocate large object (> %zu) of size %zu bytes and mmap failed with errno %d.", size, heapMaster.mmapStart, errno );
     1045                        abort( "**** Error **** attempt to allocate large object (> %zu) of size %zu bytes and mmap failed with errno %d.", size, heapMaster.mmapStart, errno );
    10451046                } // if
    10461047                block->header.kind.real.blockSize = MarkMmappedBit( tsize ); // storage size for munmap
     
    11061107                if ( unlikely( munmap( header, size ) == -1 ) ) {
    11071108                        // Do not call strerror( errno ) as it may call malloc.
    1108                         abort( "attempt to deallocate large object %p and munmap failed with errno %d.\n"
     1109                        abort( "**** Error **** attempt to deallocate large object %p and munmap failed with errno %d.\n"
    11091110                                   "Possible cause is invalid delete pointer: either not allocated or with corrupt header.",
    11101111                                   addr, errno );
     
    12161217
    12171218#ifdef __STATISTICS__
    1218 static void incCalls( long int statName ) libcfa_nopreempt {
     1219static void incCalls( intptr_t statName ) libcfa_nopreempt {
    12191220        heapManager->stats.counters[statName].calls += 1;
    12201221} // incCalls
    12211222
    1222 static void incZeroCalls( long int statName ) libcfa_nopreempt {
     1223static void incZeroCalls( intptr_t statName ) libcfa_nopreempt {
    12231224        heapManager->stats.counters[statName].calls_0 += 1;
    12241225} // incZeroCalls
     
    12261227
    12271228#ifdef __CFA_DEBUG__
    1228 static void incUnfreed( size_t offset ) libcfa_nopreempt {
     1229static void incUnfreed( intptr_t offset ) libcfa_nopreempt {
    12291230        heapManager->allocUnfreed += offset;
    12301231} // incUnfreed
     
    15671568                if ( write( STDERR_FILENO, MALLOC_STATS_MSG, sizeof( MALLOC_STATS_MSG ) - 1 /* size includes '\0' */ ) == -1 ) {
    15681569                #endif // __STATISTICS__
    1569                         abort( "write failed in malloc_stats" );
     1570                        abort( "**** Error **** write failed in malloc_stats" );
    15701571                } // if
    15711572        } // malloc_stats
Note: See TracChangeset for help on using the changeset viewer.