ACE_TAO
ACE_TAO copied to clipboard
Avoid allocating buffer when printing log.
With small embedded systems couldn't this lead faster to a stack overflow?
The size of verbose buffer on stack is VERBOSE_LEN
+ 1 = 129
.
Is it too large for embedded systems?
/// Size used by verbose mode.
/// 20 (date) + 15 (host_name) + 10 (pid) + 10 (type)
/// + 4 (@) ... + ? (progname)
VERBOSE_LEN = 128,
I now see that you replaced MAXVERBOSELOGMSGLEN with VERBOSE_LEN which is much smaller, was that the intent?
Yes. I separate a line of log message into a prefix (verbose
buffer) and content so that only prefix needs a small buffer on stack.
I find that
/// Size used by verbose mode.
/// 20 (date) + 15 (host_name) + 10 (pid) + 10 (type)
/// + 4 (@) ... + ? (progname)
VERBOSE_LEN = 128,
progname
is not formatted into verbose
buffer on stack. So VERBOSE_LEN
can be reduce to
20 + 15 + 10 + 10 + 4 = 59
Please see also:
-
https://github.com/DOCGroup/ACE_TAO/blob/9468af00a2e1863ef63cd9610d2c8b55452b716e/ACE/ace/Log_Record.cpp#L250-L252
-
https://github.com/DOCGroup/ACE_TAO/blob/9468af00a2e1863ef63cd9610d2c8b55452b716e/ACE/ace/Log_Record.cpp#L270-L278
Am I right?