Answer the question
In order to leave comments, you need to log in
Can there be an object transition from SOH to LOH and vice versa? If so, what processes are taking place at this time? Simple transition or something else?
Can there be an object transition from SOH to LOH and vice versa? If so, what processes are taking place at this time? Simple transition or something else?
Answer the question
In order to leave comments, you need to log in
no, it can't
upd:
don't confuse the total memory footprint with the size of the object. Loh will contain a conditional array of 100mb/large string. But the object that refers to it is not, because it will only contain a link weighing a couple of bytes.
I suspect you were thinking something like this
public class TestClass
{
public byte[] Bytes;
public TestClass(byte[] bytes)
{
Bytes = bytes;
}
public void Upd()
{
Bytes = new byte[101 * 1024 * 1024];
}
}
...
static void Main(string[] args)
{
var data = new TestClass[3];
for (int i = 0; i < 3; i++)
{
data[i] = new TestClass(new byte[1]);
}
data[1].Upd();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question