diff options
Diffstat (limited to 'src/fluent-bit/lib/lwrb/docs/tips-tricks')
-rw-r--r-- | src/fluent-bit/lib/lwrb/docs/tips-tricks/index.rst | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/lwrb/docs/tips-tricks/index.rst b/src/fluent-bit/lib/lwrb/docs/tips-tricks/index.rst new file mode 100644 index 000000000..feb81ce4b --- /dev/null +++ b/src/fluent-bit/lib/lwrb/docs/tips-tricks/index.rst @@ -0,0 +1,28 @@ +.. _tips_tricks: + +Tips & tricks +============= + +Application buffer size +^^^^^^^^^^^^^^^^^^^^^^^ + +Buffer size shall always be ``1`` byte bigger than anticipated data size. + +When application uses buffer for some data block ``N`` times, it is advised to set buffer size to ``1`` byte more than ``N * block_size`` is. +This is due to ``R`` and ``W`` pointers alignment. + +.. note:: + For more information, check :ref:`how_it_works`. + +.. literalinclude:: ../examples_src/example_tt_buff_size.c + :language: c + :linenos: + :caption: Application buffer size assignment + +When the code is executed, it produces following output: + +.. literalinclude:: ../examples_src/example_tt_buff_size_log.c + :caption: Application buffer size assignment output + +.. toctree:: + :maxdepth: 2
\ No newline at end of file |