Changeset: 91cd662dd1e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/91cd662dd1e3
Modified Files:
gdk/gdk_system_private.h
gdk/gdk_utils.c
Branch: Dec2025
Log Message:
Removed blk_size from allocator structure.
It was set to a fixed value and never to anything else which means we
don't need it.
diffs (67 lines):
diff --git a/gdk/gdk_system_private.h b/gdk/gdk_system_private.h
--- a/gdk/gdk_system_private.h
+++ b/gdk/gdk_system_private.h
@@ -56,7 +56,6 @@ struct allocator {
char *first_blk;
size_t used; /* memory used in last block */
size_t usedmem; /* total used memory */
- size_t blk_size; /* size of the last allocated block */
size_t objects; /* number of objects */
size_t inuse; /* number of objects in use*/
size_t free_obj_hits; /* number of object reuse*/
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1844,7 +1844,6 @@ ma_use_freed_blk(allocator *sa, size_t s
}
freed_t *f = sa->freelist_blks;
sa->freelist_blks = f->n;
- sa->blk_size = MA_BLOCK_SIZE;
sa->used = MA_BLOCK_SIZE;
sa->blks[sa->nr] = (char*)f;
sa->nr ++;
@@ -1938,7 +1937,6 @@ ma_reset(allocator *sa)
// it may have blocks we can re-use
sa->freelist = NULL;
sa->usedmem = MA_BLOCK_SIZE;
- sa->blk_size = MA_BLOCK_SIZE;
sa->objects = 0;
sa->inuse = 0;
sa->tmp_used = 0;
@@ -1956,7 +1954,7 @@ ma_realloc(allocator *sa, void *p, size_
if (r)
memcpy(r, p, oldsz);
- if (oldsz >= sa->blk_size && !ma_tmp_active(sa)) {
+ if (oldsz >= MA_BLOCK_SIZE && !ma_tmp_active(sa)) {
char* ptr = (char *) p - MA_HEADER_SIZE;
COND_LOCK_ALLOCATOR(sa);
ma_free_blk(sa, ptr);
@@ -2016,7 +2014,7 @@ static void *
if (r)
return r;
COND_LOCK_ALLOCATOR(sa);
- if (sz > (sa->blk_size - sa->used)) {
+ if (sz > (MA_BLOCK_SIZE - sa->used)) {
// out of space need new blk
size_t blk_size = MA_BLOCK_SIZE;
if (sz > blk_size){
@@ -2048,10 +2046,8 @@ static void *
sa->blks[sa->nr] = sa->blks[sa->nr-1];
sa->blks[sa->nr-1] = r;
} else {
- //sa->blk_size = blk_size;
sa->blks[sa->nr] = r;
sa->used = sz;
- //sa->usedmem += sa->blk_size;
}
sa->nr ++;
sa->usedmem += blk_size;
@@ -2122,7 +2118,6 @@ create_allocator(allocator *pa, const ch
.pa = pa,
.nr = 1,
.usedmem = MA_BLOCK_SIZE,
- .blk_size = MA_BLOCK_SIZE,
.freelist = NULL,
.freelist_blks = NULL,
.frees = 0,
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]