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

  • Home
  • SEARCH
  • 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 6681667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:36:57+00:00 2026-05-26T04:36:57+00:00

>>> sys.getsizeof(int) 436 #? does this mean int occupies 436 bytes . >>> sys.getsizeof(1)

  • 0
>>> sys.getsizeof(int)
436 #? does this mean int occupies 436 bytes .

>>> sys.getsizeof(1)
12 #12 bytes for int object, is this the memory requirement.

I thought int in python is represented by 4 bytes, why is it reporting 12 bytes

Please someone explain why is it reporting 12 bytes when int uses just 4 bytes

  • 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-05-26T04:36:57+00:00Added an answer on May 26, 2026 at 4:36 am

    Yes, an int instance takes up 12 bytes on your system. Integers (like any object) have attributes, i.e. pointers to other objects, which take up additional memory space beyond that used by the object’s own value. So 4 bytes for the integer’s value, 4 bytes for a pointer to __class__ (otherwise, Python wouldn’t know what type the object belonged to and how to start resolving attribute names that are inherited from the int class and its parents), and another 4 for the object’s reference count, which is used by the garbage collector.

    The type int occupies 436 bytes on your system, which will be pointers to the various methods and other attributes of the int class and whatever other housekeeping information Python requires for the class. The int class is written in C in the standard Python implementation; you could go look at the source code and see what’s in there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Where is Python's sys.path initialized from? UPD : Python is adding some paths before
The python implementation import sys def move(src, dst, tmp, num): if num == 1:
SELECT name FROM sys.databases -- this can list all database name in the server
Just wondering why import sys exit(0) gives me this error: Traceback (most recent call
I thought import sys sys.path.append(/home/me/mydir) is appending a dir to my pythonpath if I
sys.arg[0] gives me the python script. For example 'python hello.py' returns hello.py for sys.arg[0].
My code import sys number=int(sys.argv[1]) if number == 0 fact=1 else fact=number for (x=1;
I thought that the sys.path was a complete list of all search paths for
in this very simple example: var sys = require(sys), http = require(http); http.createServer(function(request, response)
Why is sys.maxint < (sys.maxint - 100 + 0.01) in Python?

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.