diff --git a/src/duk_debug_macros.c b/src/duk_debug_macros.c index f901904f..df744ec8 100644 --- a/src/duk_debug_macros.c +++ b/src/duk_debug_macros.c @@ -18,7 +18,7 @@ char duk_debug_summary_buf[DUK_DEBUG_SUMMARY_BUF_SIZE]; int duk_debug_summary_idx; -#define DUK_DEBUG_BUFSIZE 65536 +#define DUK_DEBUG_BUFSIZE DUK_USE_DEBUG_BUFSIZE static char buf[DUK_DEBUG_BUFSIZE]; static const char *get_level_string(int level) { diff --git a/src/duk_features.h b/src/duk_features.h index dac5689e..63e377d9 100644 --- a/src/duk_features.h +++ b/src/duk_features.h @@ -1093,6 +1093,15 @@ extern double duk_computed_nan; #define DUK_USE_ASSERTIONS #endif +/* The static buffer for debug printing is quite large by default, so there + * is an option to shrink it manually for constrained builds. + */ +#if defined(DUK_OPT_DEBUG_BUFSIZE) +#define DUK_USE_DEBUG_BUFSIZE DUK_OPT_DEBUG_BUFSIZE +#else +#define DUK_USE_DEBUG_BUFSIZE 65536 +#endif + /* * Ecmascript features / compliance options */