• kroki/tomash@moonlight.home's avatar
    BUG#23443: user-defined variables can consume too much memory in the · 5b4d9d87
    kroki/tomash@moonlight.home authored
               server
    
    The problem was that when memory was exhausted HEAP engine could crash
    (GROUP BY uses HEAP TABLE).  Alternatively, if SET was used, it could
    report an error "You may only use constant expressions with SET" instead
    of "Out of memory (Needed NNNNNN bytes)".
    
    The solution is:
     - pass MY_WME to (some) calls to my_malloc() to get correct message.
     - fix heap_write() so that the first key is skipped during cleanup
       on ENOMEM because it wasn't inserted and doesn't have to be
       deleted.
    
    No test case is provided because we can't test out-of-memory behaviour
    in our current test framework.
    5b4d9d87
hp_write.c 7.38 KB