473,796 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

python memory usage

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

But python (contrary to perl) starts an interactive interpreter which
doesn't matter when executing scripts. To get rid of it I created
a fifo (mknod xxx p) and started all programs with 'prog xxx'.
The result:

CMD RSS VSZ
perl 892 2736
python 544 2424
tclsh8.3 1100 2316

The fifo keeps Python in working memory but since the input isn't
a tty, the interactive interpreter isnt't started. Is this a
reasonable comparison or did I miss something?

Mit freundlichen Gruessen,

Peter Maas

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail pe********@mplu sr.de
-------------------------------------------------------------------
Jul 18 '05 #1
3 2160
Peter Maas wrote:
But python (contrary to perl) starts an interactive interpreter which
doesn't matter when executing scripts. To get rid of it I created
a fifo (mknod xxx p) and started all programs with 'prog xxx'.
Why didn't you just make a python script that does nothing (maybe
something like "while 1: pass")?
The result:

CMD RSS VSZ
perl 892 2736
python 544 2424
tclsh8.3 1100 2316

The fifo keeps Python in working memory but since the input isn't
a tty, the interactive interpreter isnt't started. Is this a
reasonable comparison or did I miss something?


It cold be ok, but the second rss number seems a bit low. Here (Python
2.3, FreeBSD 4.9) it looks like this:

tty-interpreter mode: rss: 2684, vsz: 3460
running the one-lined empty loop script: rss: 2212, vsz: 2992
"running" an disconnected fifo: rss: 1296, vsz: 1992
Jul 18 '05 #2
Ivan Voras wrote:
Why didn't you just make a python script that does nothing (maybe
something like "while 1: pass")?
Fifo was simpler than writing three scripts for tcl, perl and python.
And I wanted a clean comparison with Perl waiting for data from stdin,
a zero test case.
It cold be ok, but the second rss number seems a bit low. Here (Python
2.3, FreeBSD 4.9) it looks like this:

tty-interpreter mode: rss: 2684, vsz: 3460
running the one-lined empty loop script: rss: 2212, vsz: 2992
"running" an disconnected fifo: rss: 1296, vsz: 1992


Similar results on my machine:

python one-lined empty loop rss: 2148 vsz: 3608
perl one-lined empty loop rss: 1112 vsz: 2756
tclsh8.3 one-lined empty loop rss: 1096 vsz: 2316

Strange that starting an empty loop makes such a difference for python.
Anyway, the numbers are in a reasonable range, unlike the 18 MB than
came up in a discussion. Thanks for comparing.

Mit freundlichen Gruessen,

Peter Maas

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail pe********@mplu sr.de
-------------------------------------------------------------------
Jul 18 '05 #3
Peter Maas <fp********@net scape.net> wrote in message news:<c0******* ***@swifty.west end.com>...
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


Has anybody got comparable figures for a Java process?
Jul 18 '05 #4

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

Similar topics

4
5024
by: ulysses | last post by:
hi, I'm working in python 5 months. I think it's very cool language. I do a p2p python program GUI. First I make a software by wxpython. But I find wxpython use many many memory. Second I use PYQT. But memory use still big. But but but when I minimize the windows to taskbar, a fantasy something happened. memory use very very low when windows minimize.
8
2114
by: Sridhar R | last post by:
Hi, I am a little experienced python programmer (2 months). I am somewhat experienced in C/C++. I am planning (now in design stage) to write an IDE in python. The IDE will not be a simple one. I had an idea of writing the IDE in C/C++, as it is a big project, bcoz of the following 1. if python is used, then the memory required for running the IDE will be high.
0
1597
by: Robby Dermody | last post by:
Hey guys (thus begins a book of a post :), I'm in the process of writing a commercial VoIP call monitoring and recording application suite in python and pyrex. Basically, this software sits in a VoIP callcenter-type environment (complete with agent phones and VoIP servers), sniffs voice data off of the network, and allows users to listen into calls. It can record calls as well. The project is about a year and 3 months in the making and...
25
5770
by: abhinav | last post by:
Hello guys, I am a novice in python.I have to implement a full fledged mail server ..But i am not able to choose the language.Should i go for C(socket API) or python for this project? What are the advantages of one over the other in implementing this server.which language will be easier? What are the performance issues?In what language are mail servers generally written?
13
4494
by: placid | last post by:
Hi All, Just wondering when i run the following code; for i in range(1000000): print i the memory usage of Python spikes and when the range(..) block finishes execution the memory usage does not drop down. Is there a way of freeing this memory that range(..) allocated?
3
3463
by: test.07 | last post by:
I am wondering what happens to a thread in python in relation to win32com extensions. If I create a new thread, that uses the Dispatch method from win32com, what happens to the memory allocated in that thread when the thread is done. Will the Dispatch release the memory it created, or will the memory remain? The problem rises from the fact that Dispatch does not seem to release memory correctly every time. If I include the commands in...
17
8489
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
0
3088
by: greg.novak | last post by:
I am using Python to process particle data from a physics simulation. There are about 15 MB of data associated with each simulation, but there are many simulations. I read the data from each simulation into Numpy arrays and do a simple calculation on them that involves a few eigenvalues of small matricies and quite a number of temporary arrays. I had assumed that that generating lots of temporary arrays would make my program run slowly,...
1
1729
by: yzghan | last post by:
Hi all, I feel that my python script is leaking memory. And this is a test I have: log.write(" " + "test() ... memory usage: " + " ".join(repr(i/(1024*1024)) for i in getMemInfo()) + "\n") m = {} i = 1000*1000 while i 0:
1
2049
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after the objects for which that memory was allocated are no longer live in the process. This is only a leak if peak memory goes up again each time you create any new objects. Try repeated allocations of a large dictionary and observe how memory...
0
9680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
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
10228
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
10173
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
10006
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
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...
1
7547
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
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...
3
2925
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.