c# - When do (not) two strings with same content share the same memory? -


coming question will 2 strings same content stored in same memory location?

having java code

string s1="java"; 

will string allocated in same memory location (or multipe):

  • if launch same program multiple times executing in parallel (concurrently)?

possible answer:

i c# developer (though programmed in java in previous millennium).

i asked question because believed same between .net clr , java (jvm) , hoping answer .net apps (but somehow in doubt encountered "application" pool terms).

so, seems (sorry not exhaustively searching before asking):

with answer string intern pool shared per instances/programs of same jvm or .net clr.

@gennady-vanin-novosibirsk....

string s1="java";string s2="java";string s3="java";string s4="java";

  1. the above objects available in stringconstantpool location objects pointing 1 ("java") location

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -