mirror of https://gitee.com/bigwinds/arangodb
fixed issue #311
This commit is contained in:
parent
285533ab4c
commit
7c94afad4f
|
@ -1,6 +1,8 @@
|
|||
v1.1.0 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* fixed issue #311: fixed segfault on unload
|
||||
|
||||
* fixed issue #309: renamed stub "import" button from web interface
|
||||
|
||||
* fixed issue #307: added WaitForSync column in collections list in in web interface
|
||||
|
|
|
@ -114,29 +114,13 @@ static void AddNewElement (TRI_hasharray_t* array, void* element) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool AllocateTable (TRI_hasharray_t* array, size_t numElements) {
|
||||
char* data;
|
||||
char* table;
|
||||
size_t offset;
|
||||
|
||||
data = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, CACHE_LINE_SIZE + (array->_elementSize * numElements), true);
|
||||
if (data == NULL) {
|
||||
table = (char*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, CACHE_LINE_SIZE + (array->_elementSize * numElements), true);
|
||||
if (table == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// position array directly on a cache line boundary
|
||||
offset = ((intptr_t) data) % CACHE_LINE_SIZE;
|
||||
|
||||
if (offset == 0) {
|
||||
// we're already on a cache line boundary
|
||||
table = data;
|
||||
}
|
||||
else {
|
||||
// move to start of a cache line
|
||||
table = data + (CACHE_LINE_SIZE - offset);
|
||||
}
|
||||
assert(((intptr_t) table) % CACHE_LINE_SIZE == 0);
|
||||
|
||||
array->_data = data;
|
||||
array->_table = table;
|
||||
array->_nrAlloc = numElements;
|
||||
|
||||
|
@ -148,12 +132,10 @@ static bool AllocateTable (TRI_hasharray_t* array, size_t numElements) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool ResizeHashArray (TRI_hasharray_t* array) {
|
||||
char* oldData;
|
||||
char* oldTable;
|
||||
uint64_t oldAlloc;
|
||||
uint64_t j;
|
||||
|
||||
oldData = array->_data;
|
||||
oldTable = array->_table;
|
||||
oldAlloc = array->_nrAlloc;
|
||||
|
||||
|
@ -172,7 +154,7 @@ static bool ResizeHashArray (TRI_hasharray_t* array) {
|
|||
}
|
||||
}
|
||||
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, oldData);
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, oldTable);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -286,7 +268,7 @@ void TRI_DestroyHashArray (TRI_hasharray_t* array) {
|
|||
IndexStaticDestroyElement(array, p);
|
||||
}
|
||||
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, array->_data);
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, array->_table);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,11 +64,6 @@ typedef struct TRI_hasharray_s {
|
|||
uint64_t _nrAlloc; // the size of the table
|
||||
uint64_t _nrUsed; // the number of used entries
|
||||
|
||||
// _table might or might not be the same pointer as _data
|
||||
// if you want to handle the hash table memory, always use the _data pointer!
|
||||
// if you want to work with the hash table elements, always use the _table pointer!
|
||||
|
||||
char* _data; // pointer to memory acquired for the hash table
|
||||
char* _table; // the table itself, aligned to a cache line boundary
|
||||
|
||||
#ifdef TRI_INTERNAL_STATS
|
||||
|
|
Loading…
Reference in New Issue