Changeset: 6d9432d80ce3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6d9432d80ce3
Modified Files:
        monetdb5/mal/mal_exception.c
Branch: Nov2019
Log Message:

Leave a complete exception behind when you run out of memory.


diffs (26 lines):

diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -56,15 +56,20 @@ static str createExceptionInternal(enum 
 static str
 createExceptionInternal(enum malexception type, const char *fcn, const char 
*format, va_list ap)
 {
-       char *message;
+       char *message, local[GDKMAXERRLEN];
        int len;
        // if there is an error we allow memory allocation once again
 #ifndef NDEBUG
        GDKsetmallocsuccesscount(-1);
 #endif
        message = GDKmalloc(GDKMAXERRLEN);
-       if (message == NULL)
+       if (message == NULL){
+               /* Leave a message behind in the logging system */
+               len = snprintf(local, GDKMAXERRLEN, "%s:%s:", 
exceptionNames[type], fcn);
+               len = vsnprintf(local + len, GDKMAXERRLEN, format, ap);
+               fprintf(stderr, "%s", local);
                return M5OutOfMemory;   /* last resort */
+       }
        len = snprintf(message, GDKMAXERRLEN, "%s:%s:", exceptionNames[type], 
fcn);
        if (len >= GDKMAXERRLEN)        /* shouldn't happen */
                return message;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to