I have a project that I am planning, and one bit of information I'll want to have is how much memory a reference takes up in Python. AFAIK, a reference in python is the same as a pointer, and I am guessing that it would be the same size as a 32bit or 64bit pointer (but I could be wrong).
Could anyone clear this up for me, so that I don't have to go on guesswork?
1 Answer 1
This was answered in the comments through a discussion between me and SuperBiasedMan. The size of a reference in Python is the same as the word size for the CPU. So, it's 4 bytes on a 32bit build of python, and 8 bytes on 64bit python.
1 Comment
Explore related questions
See similar questions with these tags.
sys.sizeof()may help you, as it returns the size of an object in bytes.sys.getsizeof()returns the size of the referenced object, not the reference itself. Yes, Python just uses pointers for references.