System.arraycopy

Is System.arraycopy safe to use in your main loop (i.e. as it applies to GC)?

Does not get the question right.

System.arrayCopy() copies one array into another. This has nothing to do with GC.

Herkules: He’s asking if System.arraycopy() creates garbage.

Absolution: My understanding is that arraycopy is intended to be used in performance critical code. So assume yes unless someone can proove me wrong.

[quote]Herkules: He’s asking if System.arraycopy() creates garbage.
[/quote]
Sure, got that, but why should copying an array produce garbage??

Well, there’s a lot of unexpected places where Java creates a few naughty objects. But this isn’t one of them :slight_smile:

Cas :slight_smile:

Thanks, that’s helpful. Does anybody know exactly how this method works? Is it just doing a copy of the reference values in the src objects to those in the dest objects?

It does a shallow copy.