On Tue, Nov 01, 2022 at 11:18:48AM -0700, Frank Jüdes wrote: > I have to write a program that should verify the content of > configuration-servers. It will need a lot of pre-initialized data to verify > the actual content of a server, so it has to initialize many strings. What > i know from other C-style languages is, that code like > > var MyString *string = 'Hello World!'; > > Will result in having two identical copies of the string »Hello World!« in > the memory: The first one within the program-code itself and a second copy > somewhere in the heap-memory. [...] > Will there be two copies of the string »Hello World!" in the memory or just > one? As said, mMy code will contain a gazillion of pre-defined string > variables and having each string allocate two copies of itself in memory > would be bad for small systems.
In addition to what others have said, please note that you can use for analysis the usual tooling such as `objdump` and `nm` to peek at the generated executable image file, as well as Go's native `go tool objdump` and `go build -gcflags=-S` - with the latter producing the assembly code. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20221103154101.clxygi7iqsvcfegt%40carbon.