What is a linker-allocated object?

Hello fellow gophers,

This is what it says in the official documentation about finalizers:

// It is not guaranteed that a finalizer will run for objects allocated
// in initializers for package-level variables. Such objects may be
// linker-allocated, not heap-allocated.

So, what is a linker-allocated object ?

I think it may have to do with the linker allocating some objects statically, so that the memory area for them is reserved and initialized with the data loaded from the executable file, along with the program code and constants.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.