Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8232997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:59:36+00:00 2026-06-07T17:59:36+00:00

If I create 10 integers and an integer array of 10, will there be

  • 0

If I create 10 integers and an integer array of 10, will there be any difference in total space occupied?

I have to create a boolean array of millions of records, so I want to understand how much space will be taken by array itself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:59:38+00:00Added an answer on June 7, 2026 at 5:59 pm

    An array of integers is represented as block of memory to hold the integers, and an object header. The object header typically takes 3 32bit words for a 32 bit JVM, but this is platform dependent. (The header contains some flag bits, a reference to a class descriptor, space for primitive lock information, and the length of the actual array. Plus padding.)

    So an array of 10 ints probably takes in the region of 13 * 4 bytes.

    In the case on an Integer[], each Integer object has a 2 word header and a 1 word field containing the actual value. And you also need to add in padding, and 1 word (or 1 to 2 words on a 64-bit JVM) for the reference. That is typically 5 words or 20 bytes per element of the array … unless some Integer objects appear in multiple places in the array.


    Notes:

    1. The number of words actually used for a reference on a 64 bit JVM depends on whether “compressed oops” are used.
    2. On some JVMs, heap nodes are allocated in multiples of 16 bytes … which inflates space usage (e.g. the padding mentioned above).
    3. If you take the identity hashcode of an object and it survives the next garbage collection, its size gets inflated by at least 4 bytes to cache the hashcode value.
    4. These numbers are all version and vendor specific, in addition to the sources of variability enumerated above.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Dictionary with array of integer, string and boolean data
There is an array of integers, lets say 3,5,7,9. You are supposed to create
Say I have a dynamic array like: int* integers = new int[100]; Is there
I am trying to create an array of class objects taking an integer argument.
There are two tables: CREATE TABLE STORE ( ID INTEGER NOT NULL, MEDICINE_ID INTEGER
i have the following problem: Create a program where a particle will execute a
[I have some code to create a JSON array. In this code I am
I have an assignment to create an algorithm to find duplicates in an array
I have table with schema: test1 (id integer primary key , padding text) (there
I want to create a function in C. It will return a random integer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.