473,785 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5451
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*******@gmai l.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\pytho n*
[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\pytho n*
[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\pytho n*
[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
2159
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 2.4, Perl 5.6.1, Python 2.3.2, Tcl 8.3), command ps -o "cmd rss vsize", results in kBytes: CMD RSS VSZ perl 984 2760 python 2556 4188 tclsh8.3 1100 2316
7
7055
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
2595
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 when the object is instantiated. I'd ideally like to keep as many objects as possible in memory, but I can get rid of any object the program isn't currently using. Is there any way I can access the amount of memory python is using? I can
4
1495
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 slowed down by a factor of 8-14: 38 sec at 15M memory usage, 570 sec at 144M, 330 sec at 200M. Is there anything I can do to fix that? When the program is running, the system has 18M free memory and is not doing any swapping. `python -O' did...
4
3430
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 function used to calculate a specific value. thx
10
5672
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 scripts from within the app? Not just once, but many times in a single session, and without leaking memory. Preferably an open source app so I can see how it's done. Our app (http://golly.sourceforge.net/) currently uses calls like these every...
17
8488
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 file under linux python 2.4 (same problem with windows 2.5, tried with the first example) : #Python interpreter memory usage : 1.1 Mb private, 1.4 Mb shared #Using http://www.pixelbeat.org/scripts/ps_mem.py to get memory information
3
2471
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 grows as the number of frames I simulate increases. To verify this, I've used two methods, which I invoke after every frame simulated:
5
25782
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
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.