If the shared object libNNN.so has data in a read-only segment (for example, from the .rodata or .text section), then this segment is mmap -ed from MAP_SHARED to dlopen or ld.so , so there are different processes (loading libNNN.so ) with By using read-only data, they really use the physical RAM containing it.
Static or global read and write data is included in the MAP_PRIVATE read-write mmap -ed segment (from .bss or .data ), so each process has its own (still copied-on-write).
Use objdump to find out which segments are inside libNNN.so
Use pmap and /proc/1234/maps , to learn about the process of memory mapping pid 1234. (From within the application, read consecutively /proc/self/maps if needed or /proc/self/statm , if you want to measure).
note that const things in C often go into .rodata , but with C ++ data built this is no longer the case.
source share