changeset 253:e7539330735a Common_Ancestor

Merge -- "works, with test.." was mislabeled, really added DEBUG_printf3, and "move vms_defs" was adding valgrind to vmalloc
author Sean Halle <seanhalle@yahoo.com>
date Sat, 25 Aug 2012 14:53:03 -0700
parents 88f71110f1a9 4ddb91bc7aa1
children e7d2f8fad13d
files
diffstat 2 files changed, 36 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/Services_Offered_by_VMS/Memory_Handling/vmalloc.c	Sat Aug 25 12:22:21 2012 -0700
     1.2 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.c	Sat Aug 25 14:53:03 2012 -0700
     1.3 @@ -17,6 +17,8 @@
     1.4  #include "VMS_impl/VMS.h"
     1.5  #include "Histogram/Histogram.h"
     1.6  
     1.7 +#include <valgrind/memcheck.h>
     1.8 +
     1.9  #define MAX_UINT64 0xFFFFFFFFFFFFFFFF
    1.10  
    1.11  //A MallocProlog is a head element if the HigherInMem variable is NULL
    1.12 @@ -265,7 +267,8 @@
    1.13          foundChunk = removeSmallChunk(freeLists, freeListIdx);
    1.14         
    1.15        //Mark as allocated
    1.16 -      foundChunk->prevChunkInFreeList = NULL;      
    1.17 +      foundChunk->prevChunkInFreeList = NULL;  
    1.18 +      VALGRIND_MAKE_MEM_UNDEFINED(foundChunk + 1,sizeRequested);
    1.19        return foundChunk + 1;
    1.20      }
    1.21     
    1.22 @@ -284,6 +287,7 @@
    1.23           MEAS__Capture_Post_Malloc_Point
    1.24     
    1.25     //skip over the prolog by adding its size to the pointer return
    1.26 +   VALGRIND_MAKE_MEM_UNDEFINED(foundChunk + 1,sizeRequested);
    1.27     return foundChunk + 1;
    1.28   }
    1.29  
    1.30 @@ -331,6 +335,7 @@
    1.31     }
    1.32     
    1.33     size_t chunkSize = getChunkSize(chunkToFree);
    1.34 +   VALGRIND_MAKE_MEM_UNDEFINED(chunkToFree,chunkSize);
    1.35     if(chunkSize < BIG_LOWER_BOUND)
    1.36     {
    1.37         containerIdx =  (chunkSize/SMALL_CHUNK_SIZE)-1;
    1.38 @@ -383,6 +388,7 @@
    1.39     //Create first element in lastContainer 
    1.40     MallocProlog *firstChunk = malloc( MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE );
    1.41     if( firstChunk == NULL ) {printf("Can't allocate initial memory\n"); exit(1);}
    1.42 +   VALGRIND_MAKE_MEM_NOACCESS(firstChunk,MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE);
    1.43     freeLists->memSpace = firstChunk;
    1.44     
    1.45     //Touch memory to avoid page faults
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Services_Offered_by_VMS/Memory_Handling/vmalloc.supp	Sat Aug 25 14:53:03 2012 -0700
     2.3 @@ -0,0 +1,29 @@
     2.4 +{
     2.5 +   poolcreate
     2.6 +   Memcheck:Addr1
     2.7 +   fun:VMS_ext__create_free_list
     2.8 +}
     2.9 +
    2.10 +{
    2.11 +   poolcreate
    2.12 +   Memcheck:Addr4
    2.13 +   fun:VMS_ext__create_free_list
    2.14 +}
    2.15 +{
    2.16 +   poolcreate
    2.17 +   Memcheck:Addr8
    2.18 +   fun:VMS_ext__create_free_list
    2.19 +}
    2.20 +
    2.21 +{
    2.22 +   vmsmalloc
    2.23 +   Memcheck:Addr8
    2.24 +   ...
    2.25 +   fun:VMS_int__malloc
    2.26 +}
    2.27 +{
    2.28 +   vmsmalloc
    2.29 +   Memcheck:Addr4
    2.30 +   ...
    2.31 +   fun:VMS_int__malloc
    2.32 +}