Changeset: 40121743c4b6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/40121743c4b6
Modified Files:
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_prelude.c
Branch: Dec2025
Log Message:

Reduce number of GDKmalloc calls by more than 5000 during initialization.
We do this by allocating two chunks in one alloc instead of two separate
allocs.


diffs (32 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -77,7 +77,6 @@ freeSymbol(Symbol s)
                freeMalBlk(s->def);
                s->def = NULL;
        } else if (s->allocated && s->func) {
-               GDKfree(s->func->args);
                GDKfree(s->func);
        }
        GDKfree(s);
diff --git a/monetdb5/mal/mal_prelude.c b/monetdb5/mal/mal_prelude.c
--- a/monetdb5/mal/mal_prelude.c
+++ b/monetdb5/mal/mal_prelude.c
@@ -306,14 +306,12 @@ melFunction(bool command, const char *mo
        fcn = s->name;
        s->allocated = true;
 
-       f = (mel_func*)GDKmalloc(sizeof(mel_func));
-       mel_arg *args = (mel_arg*)GDKmalloc(sizeof(mel_arg)*argc);
-       if (!f || !args) {
-               GDKfree(f);
-               GDKfree(args);
+       f = GDKmalloc(sizeof(mel_func) + sizeof(mel_arg [argc]));
+       if (f == NULL) {
                freeSymbol(s);
                return MEL_ERR;
        }
+       mel_arg *args = (mel_arg *) (f + 1);
        *f = (mel_func) {
                .mod = mod,
                .fcn = fcn,
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to