Changeset: 9485efaef746 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9485efaef746
Modified Files:
gdk/gdk_bbp.c
gdk/gdk_heap.c
gdk/gdk_string.c
Branch: Jul2021
Log Message:
Minor fixes.
diffs (50 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -298,7 +298,6 @@ BBPinithash(int j)
;
BBP_hash = (bat *) GDKzalloc(BBP_mask * sizeof(bat));
if (BBP_hash == NULL) {
- GDKerror("cannot allocate memory\n");
return GDK_FAIL;
}
BBP_mask--;
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -144,16 +144,17 @@ HEAPalloc(Heap *h, size_t nitems, size_t
{
h->base = NULL;
h->size = 1;
- if (itemsize)
+ if (itemsize) {
+ /* check for overflow */
+ if (nitems > BUN_NONE / itemsize) {
+ GDKerror("allocating more than heap can accomodate\n");
+ return GDK_FAIL;
+ }
h->size = MAX(1, nitems) * itemsize;
+ }
h->free = 0;
h->cleanhash = false;
- /* check for overflow */
- if (itemsize && nitems > (h->size / itemsize)) {
- GDKerror("allocating more than heap can accomodate\n");
- return GDK_FAIL;
- }
if (GDKinmemory(h->farmid) ||
(GDKmem_cursize() + h->size < GDK_mem_maxsize &&
h->size < (h->farmid == 0 ? GDK_mmap_minsize_persistent :
GDK_mmap_minsize_transient))) {
diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c
--- a/gdk/gdk_string.c
+++ b/gdk/gdk_string.c
@@ -289,7 +289,7 @@ strPut(BAT *b, var_t *dst, const void *V
assert(newsize);
if (h->free + pad + len >= (size_t) VAR_MAX) {
- GDKerror("string heaps gets larger than %zuGiB.\n",
(size_t) VAR_MAX >> 30);
+ GDKerror("string heap gets larger than %zuGiB.\n",
(size_t) VAR_MAX >> 30);
return 0;
}
TRC_DEBUG(HEAP, "HEAPextend in strPut %s %zu %zu\n",
h->filename, h->size, newsize);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list