aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wmem
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2014-03-04 08:11:57 -0500
committerAnders Broman <a.broman58@gmail.com>2014-03-04 14:18:51 +0000
commit01467c294a21159d47ce27f271c60c8914e7c13a (patch)
tree45e06ada190646d810ee3048f8302af65e1a2c1d /epan/wmem
parent3a4b311e8b4a649ac1553e064b632a2b2fbb391b (diff)
Remove assertions from block allocator.
It has been extremely well-tested at this point, and is a very hot code path so the performance gain is measurable (~1-2% on most captures I tried). Change-Id: I2f5e03d2f348f56e740bf0dfbc83a4fd9cc8c5a9 Reviewed-on: https://code.wireshark.org/review/499 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/wmem')
-rw-r--r--epan/wmem/wmem_allocator_block.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/epan/wmem/wmem_allocator_block.c b/epan/wmem/wmem_allocator_block.c
index 29d5d42de3..c89e098a7b 100644
--- a/epan/wmem/wmem_allocator_block.c
+++ b/epan/wmem/wmem_allocator_block.c
@@ -407,8 +407,6 @@ wmem_block_add_to_recycler(wmem_block_allocator_t *allocator,
{
wmem_block_free_t *free_chunk;
- g_assert(! chunk->used);
-
if (WMEM_CHUNK_DATA_LEN(chunk) < sizeof(wmem_block_free_t)) {
return;
}
@@ -441,15 +439,10 @@ wmem_block_remove_from_recycler(wmem_block_allocator_t *allocator,
{
wmem_block_free_t *free_chunk;
- g_assert (! chunk->used);
-
free_chunk = WMEM_GET_FREE(chunk);
- g_assert(free_chunk->prev && free_chunk->next);
-
if (free_chunk->prev == chunk && free_chunk->next == chunk) {
/* Only one item in recycler, just empty it. */
- g_assert(allocator->recycler_head == chunk);
allocator->recycler_head = NULL;
}
else {
@@ -512,8 +505,6 @@ wmem_block_merge_free(wmem_block_allocator_t *allocator,
wmem_block_chunk_t *left_free = NULL;
wmem_block_chunk_t *right_free = NULL;
- g_assert(!chunk->used);
-
/* Check the chunk to our right. If it is free, merge it into our current
* chunk. If it is big enough to hold a free-header, save it for later (we
* need to know about the left chunk before we decide what goes where). */
@@ -592,9 +583,6 @@ wmem_block_split_free_chunk(wmem_block_allocator_t *allocator,
size_t aligned_size, available;
gboolean last;
- g_assert(!chunk->used);
- g_assert(WMEM_CHUNK_DATA_LEN(chunk) >= size);
-
aligned_size = WMEM_ALIGN_SIZE(size) + WMEM_CHUNK_HEADER_SIZE;
if (WMEM_CHUNK_DATA_LEN(chunk) < aligned_size + sizeof(wmem_block_free_t)) {
@@ -687,9 +675,6 @@ wmem_block_split_used_chunk(wmem_block_allocator_t *allocator,
size_t aligned_size, available;
gboolean last;
- g_assert(chunk->used);
- g_assert(WMEM_CHUNK_DATA_LEN(chunk) >= size);
-
aligned_size = WMEM_ALIGN_SIZE(size) + WMEM_CHUNK_HEADER_SIZE;
if (aligned_size > WMEM_CHUNK_DATA_LEN(chunk)) {
@@ -905,20 +890,9 @@ wmem_block_alloc(void *private_data, const size_t size)
chunk = allocator->master_head;
}
- /* if our chunk is used, something is wrong */
- g_assert(! chunk->used);
- /* if we still don't have the space at this point, something is wrong */
- g_assert(size <= WMEM_CHUNK_DATA_LEN(chunk));
-
/* Split our chunk into two to preserve any trailing free space */
wmem_block_split_free_chunk(allocator, chunk, size);
- /* if our split reduced our size too much, something went wrong */
- g_assert(size <= WMEM_CHUNK_DATA_LEN(chunk));
- /* the resulting chunk should not be in either free list */
- g_assert(chunk != allocator->master_head);
- g_assert(chunk != allocator->recycler_head);
-
/* Now cycle the recycler */
wmem_block_cycle_recycler(allocator);
@@ -942,8 +916,6 @@ wmem_block_free(void *private_data, void *ptr)
return;
}
- g_assert(chunk->used);
-
/* mark it as unused */
chunk->used = FALSE;
@@ -967,8 +939,6 @@ wmem_block_realloc(void *private_data, void *ptr, const size_t size)
return wmem_block_realloc_jumbo(allocator, chunk, size);
}
- g_assert(chunk->used);
-
if (size > WMEM_CHUNK_DATA_LEN(chunk)) {
/* grow */
wmem_block_chunk_t *tmp;