Thread history

Fragment of a discussion from Talk:XanderCat
Viewing a history listing
Jump to navigation Jump to search
Time User Activity Comment
No results

Local variables are stored on the stack but any time you use new it will go on the heap afaik:

public void MyFunc(Object a) {

  Object b = a; // Variable b is on the stack, pointing at a.
  b = new Object(); // Memory allocated on heap, referenced by variable b on the stack

}

This is my understanding of it. Please correct me if I am wrong!

Wolfman06:57, 4 April 2013