View source for Talk:ScalarNext/Version History

From Robowiki
Jump to navigation Jump to search

Contents

Thread titleRepliesLast modified
Java 8 Stack Allocation105:32, 24 February 2018

Java 8 Stack Allocation

It seems that when an object is allocated in a function, and never escapes that, Java would replace the allocation to stack if the reference is not modified, which means Java would not reuse previously allocated memory for new objects in this case.

e.g.

void stack() {
  Point2D.Double a = new Point2D.Double(0, 0);
  a.setLocation(1, 1);
}

a could be allocated on stack, while

void heap() {
  Point2D.Double b = new Point2D.Double(0, 0);
  b = new Point2D.Double(1, 1);
}

b can not be allocated on stack.

Xor (talk)05:27, 24 February 2018

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:Talk:ScalarNext/Version History/Java 8 Stack Allocation/reply.