G
Guest
The question is about JVM.
I have a
string = new String("aa...aa")
with
size() == 10000
when I call
string2 = string.substring(0, 9000)
string2 allocates another block of memory, or simply points to the same
block of memory with private startIndex and endIndex?
I ask because I want to use this function (substring) in time-critical
loop. If substring allocates extra memory it is not acceptable.
I forgot: after substring, no other changes to string2
I have a
string = new String("aa...aa")
with
size() == 10000
when I call
string2 = string.substring(0, 9000)
string2 allocates another block of memory, or simply points to the same
block of memory with private startIndex and endIndex?
I ask because I want to use this function (substring) in time-critical
loop. If substring allocates extra memory it is not acceptable.
I forgot: after substring, no other changes to string2