473,911 Members | 5,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory Usage

rbt
Would a Python process consume more memory on a PC with lots of memory?

For example, say I have the same Python script running on two WinXP
computers that both have Python 2.4.0. One computer has 256 MB of Ram
while the other has 2 GB of Ram. On the machine with less Ram, the
process takes about 1 MB of Ram. On the machine with more Ram, it uses 9
MB of Ram.

Is this normal and expected behavior?

Thanks,

rbt
Jul 18 '05 #1
8 3680
rbt wrote:
Would a Python process consume more memory on a PC with lots of memory?

For example, say I have the same Python script running on two WinXP
computers that both have Python 2.4.0. One computer has 256 MB of Ram
while the other has 2 GB of Ram. On the machine with less Ram, the
process takes about 1 MB of Ram. On the machine with more Ram, it uses 9
MB of Ram.

Is this normal and expected behavior?


It's probably not normal if this is *really* the memory usage, but
I would expect to see such behaviour, given how difficult it is
to measure *actual* memory usage. How are you measuring it?
Just by looking at the Mem Usage column in the Task Manager?

-Peter
Jul 18 '05 #2
rbt
Peter Hansen wrote:
rbt wrote:
Would a Python process consume more memory on a PC with lots of memory?

For example, say I have the same Python script running on two WinXP
computers that both have Python 2.4.0. One computer has 256 MB of Ram
while the other has 2 GB of Ram. On the machine with less Ram, the
process takes about 1 MB of Ram. On the machine with more Ram, it uses
9 MB of Ram.

Is this normal and expected behavior?

It's probably not normal if this is *really* the memory usage, but
I would expect to see such behaviour, given how difficult it is
to measure *actual* memory usage. How are you measuring it?
Just by looking at the Mem Usage column in the Task Manager?

-Peter


That's right. I look at that column. Should I measue mem usage in some
other way?
Jul 18 '05 #3
"rbt" wrote:
For example, say I have the same Python script running on two WinXP computers that both have
Python 2.4.0. One computer has 256 MB of Ram while the other has 2 GB of Ram. On the machine with
less Ram, the process takes about 1 MB of Ram. On the machine with more Ram, it uses 9 MB of Ram.

Is this normal and expected behavior?


1 MB sounds low, 9 MB sounds more reasonable for a script that uses a few mega-
bytes of data. what tool are you using to determine the process size?

</F>

Jul 18 '05 #4
rbt wrote:
Peter Hansen wrote:
I would expect to see such behaviour, given how difficult it is
to measure *actual* memory usage. How are you measuring it?
Just by looking at the Mem Usage column in the Task Manager?


That's right. I look at that column. Should I measue mem usage in some
other way?


Probably, but for a start, have you noticed that even just
switching to another window can drastically affect the
memory apparently used by an application? For example,
running the wxPython demo, clicking on a few controls and
getting memory usage up to 27MB, then minimizing the window
will drop it down aboiut 2MB. Restoring the window will
bring the amount back to only about 4MB, at least until
you click on stuff. Even then, it might climb to only
about 14MB or so.

This particular phenomenon might not be affecting your
application, but it's an indication of how bad this
measurement technique can be.

Inside the Control Panel, you will find "Administra tive Tools".
In there is a "Performanc e" gadget. It's not trivial to
use, and I can't give a tutorial here, but if you can
manage to display the Working Set for the specific Process
in which you are interested, that's probably a better
way to view the information. (To be honest, I think it's
actually this particular value which the "Mem Usage"
field shows in the Task Manager, but at least this way
you get a real-time graph and more precision, and a
record of the usage.) There are also dozens of other
parameters you can examine to help you track down the
actual usage, or to help find out what is going if it turns
out that you really are using such different amounts on
the two machines.

More important than any of this, however, might be making
sure you have similar conditions on the two machines. Are
you terminating as many other processes as you can? Making
sure there is ample Physical Memory Available (see the
Performance tab of Task Manager, for example)? If you
have one of the machines running out of memory because
of other applications running, it is quite possible that
the OS will steal memory from the Python process to feed
the other apps, and that can show up in the working set size.

As I said, this stuff isn't exactly straightforward , so
it's not necessarily surprising you are seeing this behaviour.
There's probably a relatively simple explanation, however,
but it might come only after a bit of exploration.

-Peter
Jul 18 '05 #5
Do you have a page file?

The Mem column should be RAM usage and not total working set. Some of it
could be swapped to the page file. A free tool like process explorer can
give you better informaton than the task manager.

"rbt" <rb*@athop1.ath .vt.edu> wrote in message
news:ct******** **@solaris.cc.v t.edu...
Would a Python process consume more memory on a PC with lots of memory?

For example, say I have the same Python script running on two WinXP
computers that both have Python 2.4.0. One computer has 256 MB of Ram
while the other has 2 GB of Ram. On the machine with less Ram, the process
takes about 1 MB of Ram. On the machine with more Ram, it uses 9 MB of
Ram.

Is this normal and expected behavior?

Thanks,

rbt

Jul 18 '05 #6
[<rb*@athop1.ath .vt.edu>]
Would a Python process consume more memory on a PC with lots of
memory?

For example, say I have the same Python script running on two WinXP
computers that both have Python 2.4.0. One computer has 256 MB of Ram
while the other has 2 GB of Ram. On the machine with less Ram, the
process takes about 1 MB of Ram. On the machine with more Ram, it uses
9 MB of Ram.

Is this normal and expected behavior?


[and later confirms he's looking at Mem Usage in Task Manager]

256MB is on the low end for an XP system, and will generally cause
lots of swap space (virtual memory residing on disk -- kinda) to get
used. Mem Usage doesn't count swap space, just RAM currently in use.
Under Task Manager it's better to look at the VM Size column, which
tells roughly how much virtual address space is assigned to the
process, and regardless of how it's currently split between RAM and
disk. You may need to use View -> Select Columns to get this
statistic displayed. If your process is in fact using a fixed amount
of address space, the VM Size column will stay steady but Mem Usage
may jump all over the place as time goes on. In general, I would
expect VM Size to be about the same on your two boxes; I would not
expect Mem Usage to be the same.
Jul 18 '05 #7
In message <ct**********@s olaris.cc.vt.ed u>, rbt <rb*@athop1.ath .vt.edu>
writes
That's right. I look at that column. Should I measue mem usage in some
other way?


Try VM Validator, a free memory visualization tool from Software
Verification.

http://www.softwareverify.com
http://www.softwareverify.com/vmValidator/index.html

It shows paged memory usage and also Virtual Memory manager usage on
separate tabs. Colour coded visual representation of each 4K page of
memory.

Probably more use on more memory intensive applications than yours, but
may still shed some light all the same. Either launch Python from VM
Validator, or inject VM Validator into your running Python.exe process.

Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk
RSI Information: http://www.objmedia.demon.co.uk/rsi.html
Jul 18 '05 #8
Stuart McGarrity wrote:
Do you have a page file?

The Mem column should be RAM usage and not total working set. Some of it
could be swapped to the page file. A free tool like process explorer can
give you better informaton than the task manager.


As Tim pointed out, "View->Select Columns" and activating "VM Size" is enough to
find out how much memory that program actually has *mapped* (rather than
currently loaded into RAM).

Cheers,
Nick.

--
Nick Coghlan | nc******@email. com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
Jul 18 '05 #9

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

Similar topics

5
6104
by: Justice | last post by:
Currently I'm doing some experimenting with the XMLHTTP object in Javascript. Now, the XMLHttp object is asynchronous (at least in this case), and the following code causes a significant memory loss even though I seem to be allocaitng everything; help would be *vastly* appreciated. What am I doing wrong here? I thought I was doing everything correctly (setting things to null, for example) but none of the memory seems to get replaced. ...
2
460
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting the app I load some things into memory for global use of the app but I'll use only 2 starting forms to explain the situation) situation 1 start app with form 1 (72mb memory usage), show form 2 and hide form 1 (89 mb memory usage
6
3283
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that, no memory is lying around. GC reports only 84k of allocations. Starting 5-10 of this apps is going to start taking a considerable amount of memory. Is there a way to reduce this? Tom
2
422
by: Jarvis | last post by:
I've made a testing program to test the memory usage of some Data Forms. I create a MDI parent form with one single MDI child form, which is a Data Form generated by .NET Data Form Wizard. To test the stuff, I keep to open that child data form for about 10 times. the memory usage shown in GC and task manager both increase. Then I close all those forms. and perform GC collect. The memory usage shown in GC falls, however, the memory...
3
4163
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database periodically. What happens, is that the app reads the contents of a text file line by line into an ArrayList. Each element of the ArrayList is a string representing a record from the file. The ArrayList is then processed, and the arraylist goes out of...
20
4258
by: Philip Carnstam | last post by:
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the memory usage drops to a couple hundred KB. Why? Is there anything I should to to prevent this? I have compiled in release and deactivated all forms of debugging, I think! Thanks, Philip
13
2873
by: Ilias Lazaridis | last post by:
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure. It's most possibly caused by trac and it's dependencies, but several components of the OS where updated, too.
1
1738
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
2058
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
9879
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
11349
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
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
11057
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
10541
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...
1
8099
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...
1
4776
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
4341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3360
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.