LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-10-2014, 03:59 AM   #1
fantasy1215
Member
 
Registered: Oct 2011
Posts: 75

Rep: Reputation: Disabled
How to tell why would python program take so much Virtual Image?


I have a small python socket daemon server program, when I use top to watch this process,
it took so much virtual image that exceed so much as I expected, Is there a way that I can tell why would it take so much?
Thanks in advance!
 
Old 06-10-2014, 07:10 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Of course, your Python program could have a bug in it. Although these language interpreters have automatic memory management, you do need to make sure that there are no lingering references to memory which you did allocate, which would prevent the interpreter's "garbage collector" from doing its job.

But also remember that operating systems (and languages, for that matter ...) are lazy by design. If they don't have to do something, they won't. If the system isn't under any memory-pressure, then: "the RAM is there to be used, so let us use it without any further ado." Memory-cleanup would (literally) be a waste of time. The storage allocation might therefore be larger than it ordinarily would be, just because it can be.

If you're observing memory pressure from a Python program, then it will either be one of two things: it really is a bigger program than you thought, or it has some kind of bug in it.
 
Old 06-10-2014, 09:26 AM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
What do you mean by "so much", exactly?

How much of it do you think is taken up by the Python interpreter itself?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Python TypeError when calling Python program from a Bash script noppeli Programming 2 01-15-2013 08:06 AM
python: extract metadata from image Ephracis Programming 2 03-13-2009 01:38 PM
Newbie in Python: how to display an image? browny_amiga Programming 3 11-03-2008 04:07 AM
Python: Can you add text to an image in python? BrianK Programming 2 04-03-2008 03:56 PM
Python Add Image Gerardoj Programming 2 11-09-2003 04:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration