0

How Java stores objects like int[] in memory, what is they structure?

Not complex compound types like ArrayList - the question is not about them. I want to know exactly about arrays of primitive types like a int[].

Can't find any detailed information on this, other than that these are just chunks of memory. Although there is a whole structure - pointers and so on ...

Thanks a lot,

Gudot

3
  • 3
    That's going to depend on the particular implementation. The most common is probably a C style pointer with some metadata (like size), but that shouldn't matter to anyone writing a program in Java- those kind of details aren't exposed in any way. Commented May 20, 2021 at 22:25
  • Thanks. My question for in-depth understanding and study of details. Commented May 20, 2021 at 22:29
  • 3
    The hotspot source code is on GitHub. If you want to know implementation details - and this goes for anything, not just the JVM - then you should be prepared for the fact that you might have to go and look yourself. There is a good reason that low-level implementation details aren't well-documented and that's because they quickly become outdated. As a rule of thumb, if you don't know where to begin looking for an implementation detail, you probably don't have a good enough reason to not know or care about it. Commented May 20, 2021 at 22:47

1 Answer 1

1

The general structure of an array is like this:

enter image description here

And here you have a great explanation from a great source; Oracle Documentation Its a great -begginer friendly- tutorial ;)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.