Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff vmalloc.c @ 175:de5e7c522f1f
aligned memory allocation
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 20 Dec 2011 19:17:11 +0100 |
| parents | c3f458403cd6 |
| children | 0320b49ca013 |
line diff
1.1 --- a/vmalloc.c Tue Dec 20 16:50:21 2011 +0100 1.2 +++ b/vmalloc.c Tue Dec 20 19:17:11 2011 +0100 1.3 @@ -141,7 +141,9 @@ 1.4 MallocProlog *divideChunk(MallocProlog* chunk, size_t newSize) 1.5 { 1.6 MallocProlog* newChunk = (MallocProlog*)((uintptr_t)chunk->nextHigherInMem - 1.7 - newSize - sizeof(MallocProlog)); 1.8 + newSize); 1.9 + 1.10 + newChunk = __align_adress((uintptr_t)newChunk+CACHELINE_SIZE-1)-sizeof(MallocProlog); 1.11 1.12 newChunk->nextLowerInMem = chunk; 1.13 newChunk->nextHigherInMem = chunk->nextHigherInMem; 1.14 @@ -212,7 +214,7 @@ 1.15 #endif 1.16 //======================================================================== 1.17 1.18 - sizeRequested += CACHELINE_SIZE; //Allocate more than cacheline_size to avoid false sharing 1.19 + sizeRequested += (2*CACHELINE_SIZE); //Allocate more than cacheline_size to avoid false sharing 1.20 1.21 MallocArrays* freeLists = _VMSMasterEnv->freeLists; 1.22 MallocProlog* foundChunk;
