Arena allocation is a C++-only feature that helps you optimize your memory usage and improve performance when working with protocol buffers.
This Blog is first of all memos for me!! From time to time I get exposed to new and cool stuff for developers and architects ,most of the time its a solution for a problem or tips or tricks, so, I would like to track my memos and share it with you, it can save your time and nervous, I hope you will enjoy it - by Yaniv Tzanany.
Arena allocation is a C++-only feature that helps you optimize your memory usage and improve performance when working with protocol buffers.
great pdf with instruction about coding standards
Joint Strike Fighter Air Vehicle C++ Coding Standards
to work with gdb command line make sure all the symbolic will not loaded , the default is ON.
the next parameter control such behavior
in gdb type 'set auto-solib-add off' - disabled loading any symbolic files.
you can start your program
and when your SO files loaded , you can CTRL-C
and use the share command to load your so symbolic file.
share /path/mysofile.so
option 2 : put in your program the next line
__asm__ volatile("int $0x03");
its will break into your gdb and use share command to load your symbolic .
enjoy
Yaniv Tzanany
you can add custom view for debugger.
https://www.cppstories.com/2021/natvis-tutorial/
https://devblogs.microsoft.com/cppblog/debug-visualizers-in-visual-c-2015/
create into your root folder xxx.natvis
make sure in the launch.json to add
more sample:
note:
the Name of the class must be full qualified e.g. contain namespace name if exist.
even typedef name should be act as new Name in the natvis file.
ty
enjoy
Yaniv
sample template class:
sample template natvis file:
the orders of members in a struct affect sizeof of struct
see this example https://www.joshcaratelli.com/blog/struct-packing
if no compiler directive - memory align to 8 bytes by default
struct top
{
char* p; //8 bytes
int i; //4 bytes
short s; // 2 bytes
char c; // 1 byte
// 1 padding
int t; // 4 bytes
// 4 padding
};
struct buttom
{
char c; // 1 bytes -- 7 padding
char* p; //8 bytes
short s; //2 bytes
int i; //4 bytes
// 2 padding
int t; // 4 bytes
// 4 padding
};
int sizeTop = sizeof(top); // =>24
int sizeButtom = sizeof(buttom); // =>32
https://www.geeksforgeeks.org/template-metaprogramming-in-c
https://en.wikipedia.org/wiki/Memoization
Better C++14 reflections - Antony Polukhin
Reading Binary Data with Style: A Serialization Framework for C++17
https://github.com/apolukhin/magic_get
https://github.com/Neargye/magic_enum
https://github.com/neobrain/blobify
https://www.youtube.com/watch?v=vwrXHznaYLA
https://www.youtube.com/watch?v=wQxj20X-tIU
https://www.youtube.com/watch?v=VBI6TSo8Zog&list=PLWxziGKTUvQFIsbbFcTZz7jOT4TMGnZBh
Template Metaprogramming: Type Traits
Walter E. Brown "Modern Template Metaprogramming -- good
https://en.wikipedia.org/wiki/Template_metaprogramming
https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern