memory overhead of static const char?

Erik Rull erik.rull@rdsoftware.de
Fri May 25 20:45:00 GMT 2012


Hi all,

when having a .cpp file that contains lines like:

static const char * data = "test";

compile it with -fPIC and link it as a .so file - how big is the actual 
overhead beside the 5 byte text (incl. terminating \0)?

I saw that there are symbols created in the .so file when looking at it 
with objdump -x

I don't need these symbols because I use the defined variables only locally 
in the .cpp file and nobody outside accesses them - maybe another variable 
declaration prevents creating these symbols and reduces the needed memory?

Best regards,

Erik



More information about the Gcc-help mailing list