MySQL 8.0.32
Source Code Documentation File Reference
#include "sql/check_stack.h"
#include "my_config.h"
#include <stdio.h>
#include <algorithm>
#include <atomic>
#include <new>
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "sql/current_thd.h"
#include "sql/derror.h"
#include "sql/sql_class.h"


#define used_stack(A, B)   (long)(A - B)


bool check_stack_overrun (const THD *thd, long margin, unsigned char *buf)
 Check stack for a overrun. More...


std::atomic< long > max_stack_used

Macro Definition Documentation

◆ used_stack

#define used_stack (   A,
)    (long)(A - B)

Function Documentation

◆ check_stack_overrun()

bool check_stack_overrun ( const THD thd,
long  margin,
unsigned char *  buf 

Check stack for a overrun.

thdThread handler.
marginMinimal acceptable unused space in the stack.
bufSee a note below.
false if success, true if error (reported).
Note: The 'buf' parameter is necessary, and we must have code which uses it.
  • Some of the fix_fields functions have a "dummy" buffer large enough for the corresponding execution. (Thus we only have to check in fix_fields.)
  • Passing the buffer to check_stack_overrun() prevents the compiler from removing it.
  • For -flto builds, the dummy buffer may be optimized away, so we need to write something into it.

Variable Documentation

◆ max_stack_used

std::atomic<long> max_stack_used