473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Memory usage of an 'empty' python interpreter

I was wondering what the approximate amount of memory needed to load a
Python interpreter (only, no objects, no scripts, no nothing else) in a
Linux 2.6 environment. According to ps, it appears to be 3312 bytes,
which seems absurdly low to me. However, when I check the size of my
Python executable, it looks like it is only about 5600 bytes in size,
so maybe this is reasonable?

Right now, I currently have one bare Python interpreter running and no
other Python programs. Here is the output of ps -aux | grep python
(headers added for readability):

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME
COMMAND
paul 17561 0.1 0.6 14616 3312 pts/2 S+ 02:33 0:00 python
paul 17569 0.0 0.1 2600 520 pts/3 R+ 02:34 0:00 grep
python

If I am reading this right, it says the Python interpreter itself is
using 3312 bytes of memory, but has 14616 bytes of shared memory it can
access (which, i assume, is mostly shared libraries).

Here's my ls -l /usr/bin/python2.4:

-rwxr-xr-x 1 root root 5424 Jul 21 08:02 /usr/bin/python2.4

Am I interpreting this stuff more or less correctly?

Thanks!

Aug 16 '06 #1
6 5408
Ant

ne*******@gmail.com wrote:
I was wondering what the approximate amount of memory needed to load a
Python interpreter (only, no objects, no scripts, no nothing else) in a
Linux 2.6 environment. According to ps, it appears to be 3312 bytes,
which seems absurdly low to me. However, when I check the size of my
Python executable, it looks like it is only about 5600 bytes in size,
so maybe this is reasonable?
Are you sure ps is reporting in bytes not KB? The bare interpreter in
Windows is 3368KB.
On my Gentoo server ps reports 2788KB for the bare interpreter.

Aug 16 '06 #2
ne*******@gmail.com wrote:
I was wondering what the approximate amount of memory needed to load a
Python interpreter (only, no objects, no scripts, no nothing else) in a
Linux 2.6 environment. According to ps, it appears to be 3312 bytes,
which seems absurdly low to me.
Your spidey sense is working properly, 3312 bytes is absurdly low.
Here is the output of ps -aux | grep python

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME
COMMAND
paul 17561 0.1 0.6 14616 3312 pts/2 S+ 02:33 0:00 python
[SNIP]
If I am reading this right, it says the Python interpreter itself is
using 3312 bytes of memory, but has 14616 bytes of shared memory it can
access (which, i assume, is mostly shared libraries).
Nope, ps output for those values is in kilobytes. It's a bit over 3 MB
RSS, 14MB shared.
Here's my ls -l /usr/bin/python2.4:

-rwxr-xr-x 1 root root 5424 Jul 21 08:02 /usr/bin/python2.4
I'm not sure what's up here (maybe a shell script wrapper?) try "file
/usr/bin/python2.4" and "ls -alh /usr/bin/python2.4".

Aug 16 '06 #3
>>>>neokosmos <ne*******@gmail.comwrites:
I was wondering what the approximate amount of memory needed to load a
Python interpreter (only, no objects, no scripts, no nothing else) in a
Linux 2.6 environment. According to ps, it appears to be 3312 bytes,
which seems absurdly low to me. However, when I check the size of my
Python executable, it looks like it is only about 5600 bytes in size,
so maybe this is reasonable?
It is, when you consider that ps reports in kilobytes :-). It's
meaningless just to compare the size of the python binary. In your case it's
obvious that the python binary is linking to a shared python library.

Ganesan

--
Ganesan Rajagopal

Aug 16 '06 #4

Ant wrote:
ne*******@gmail.com wrote:
I was wondering what the approximate amount of memory needed to load a
Python interpreter (only, no objects, no scripts, no nothing else) in a
Linux 2.6 environment. According to ps, it appears to be 3312 bytes,
which seems absurdly low to me. However, when I check the size of my
Python executable, it looks like it is only about 5600 bytes in size,
so maybe this is reasonable?

Are you sure ps is reporting in bytes not KB? The bare interpreter in
Windows is 3368KB.
Where did you get that from? With Python 2.4.3, on my machine (Win XP
SP2):

C:\junk>dir \python24\python*
[snip]
29/03/2006 05:35 PM 4,608 python.exe
29/03/2006 05:35 PM 1,871,872 python24.dll
29/03/2006 05:35 PM 5,120 pythonw.exe

Aug 16 '06 #5
Ant
Are you sure ps is reporting in bytes not KB? The bare interpreter in
Windows is 3368KB.

Where did you get that from? With Python 2.4.3, on my machine (Win XP
SP2):

C:\junk>dir \python24\python*
[snip]
29/03/2006 05:35 PM 4,608 python.exe
29/03/2006 05:35 PM 1,871,872 python24.dll
29/03/2006 05:35 PM 5,120 pythonw.exe
He's asking for the memory required, not the disk space used by the
exe. The 3368KB is reported by the Task Manager.

Aug 16 '06 #6

Ant wrote:
Are you sure ps is reporting in bytes not KB? The bare interpreter in
Windows is 3368KB.
Where did you get that from? With Python 2.4.3, on my machine (Win XP
SP2):

C:\junk>dir \python24\python*
[snip]
29/03/2006 05:35 PM 4,608 python.exe
29/03/2006 05:35 PM 1,871,872 python24.dll
29/03/2006 05:35 PM 5,120 pythonw.exe

He's asking for the memory required, not the disk space used by the
exe. The 3368KB is reported by the Task Manager.
Doh! Low blood sugar -- that's the excuse du jour :-)

Cheers,
John

Aug 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Peter Maas | last post by:
In a recent discussion somebody claimed that python executable has a huge memory consumption compared to perl and tcl, about 18 MB. I didn't believe that and checked on my machine (SusE 7.3, Linux...
7
by: Jon Perez | last post by:
When you run an empty while loop under Python , it slows down the rest of the system. Is this normal? And should it be something that needs to be corrected?
3
by: Ian | last post by:
Hi all, I have a problem. I have an application which needs to work with a lot of data, but not all at the same time. It is arranged as a set of objects, each with lots of data that is created...
4
by: Hallvard B Furuseth | last post by:
I have a program which starts by reading a lot of data into various dicts. When I moved a function to create one such dict from near the beginning of the program to a later time, that function...
4
by: Hermann Maier | last post by:
hi, i need to find out the memory usage of a specific function that i use in my program. this function does some recursive calculations and i want my program to display the amount of memory the...
10
by: Andrew Trevorrow | last post by:
No response to my last message, so I'll try a different tack... Does anyone know of, or even better, has anyone here written a C++ application for Mac/Windows that allows users to run Python...
17
by: frederic.pica | last post by:
Greets, I've some troubles getting my memory freed by python, how can I force it to release the memory ? I've tried del and gc.collect() with no success. Here is a code sample, parsing an XML...
3
by: crazy420fingers | last post by:
I'm running a python program that simulates a wireless network protocol for a certain number of "frames" (measure of time). I've observed the following: 1. The memory consumption of the program...
5
by: Santiago Romero | last post by:
Is there a way to check the REAL size in memory of a python object? Something like or or something like that ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.