C string literal storage between multiple copies of a process or library

What is the behavior of various systems when you have more than one copy of a specific program or library, do string literals run once in RAM or once for each copy of a process / library? What if they are stored in an array like:

static const char *const foo[] = { "bar", "baz", "buz" };

Does behavior staticchange memory behavior?

Edit: since this is probably platform specific, what is the behavior of the Microsoft compiler on Windows or the GCC on Linux (x86)?

0
source share
5 answers

, , , , . . , , , . Copy On Write (COW).

, , , , , , .

, , COW.

.

, , . , , , , .

(oxymoron), , , , t , , , .

+2

, , .

?

, .

+1

(, ), . ( , ). , ( ) , "" , . (), . , .

PE . , . , .

+1

static , . , , , , .

0

Windows , Unix/Linux , , RAM , . . , , , , . ( Win16 , , Win32 )

(, ) ( )

UPDATE: Windows DLL, "shared". , , , .

-1
source

Source: https://habr.com/ru/post/1765370/


All Articles