Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31775

Re: Python does not take up available physical memory

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'configure': 0.04; 'interpreter': 0.04; 'subject:Python': 0.05; '(python': 0.05; 'memory.': 0.05; 'append': 0.07; 'chunk': 0.07; 'parameter': 0.07; 'python': 0.09; '32-bit': 0.09; 'buffer,': 0.09; 'chunks': 0.09; 'ide': 0.09; 'parsed': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'windows,': 0.09; 'subject:not': 0.11; '(there': 0.16; '4gb': 0.16; 'low-level': 0.16; 'oct': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'tries': 0.17; 'memory': 0.18; 'windows': 0.19; 'file.': 0.20; 'trying': 0.21; 'task': 0.23; "i've": 0.23; 'pass': 0.25; 'tried': 0.25; 'setting': 0.26; 'older': 0.27; 'raw': 0.27; '2.3': 0.27; 'header:X-Complaints-To:1': 0.28; 'lines': 0.28; 'appending': 0.29; 'i/o': 0.29; 'fri,': 0.30; 'file': 0.32; 'addresses': 0.32; 'goes': 0.33; 'allocated': 0.33; 'loading': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'another': 0.33; 'version': 0.34; "can't": 0.34; 'server': 0.35; 'list': 0.35; 'follows:': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'why': 0.37; '(for': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'address': 0.60; 'most': 0.61; 'first': 0.61; 'free': 0.61; 'time,': 0.62; 'within': 0.64; 'physical': 0.69; '(each': 0.84; '1gb': 0.84; '512': 0.84; 'dennis': 0.91; 'subject:available': 0.96
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Python does not take up available physical memory
Date Fri, 19 Oct 2012 18:01:22 -0400
Organization > Bestiaria Support Staff <
References <76D03718A3233B4C8CC236C169B535B5A23E063E45@AUSP01VMBX08.collaborationhost.net>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-76-249-17-7.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 3.3/32.846
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2538.1350684094.27098.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1350684094 news.xs4all.nl 6845 [2001:888:2000:d::a6]:55299
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31775

Show key headers only | View raw


On Fri, 19 Oct 2012 12:08:53 -0500, Pradipto Banerjee
<pradipto.banerjee@adainvestments.com> declaimed the following in
gmane.comp.python.general:

> Hi,
> 
> I am trying to read a file into memory. The size of the file is around 1 GB. I have a 3GB memory PC and the Windows Task Manager shows  2.3 GB available physical memory when I was trying to read the file. I tried to read the file as follows:

1)	32-bit Windows OS can only physically address 4GB BUT
2)	Unless you have a SERVER version of windows, the most allocated to a
user process is 2GB (there is a boot-time parameter which can configure
WinXP [for example] to allow 3GB to user processes -- the last GB is
always reserved for the OS)

> Is there any reason why python can't read a 1GB file in memory even when a 2.3 GB physical memory is available? Do I need to make a change in some setting or preferences?
> 
> I am using python(x,y) distribution (python 2.7) and use Spyder as the IDE.
>
	Are you /running/ from within the IDE -- such that the Python
interpreter is considered part of the IDE address space?

	<snipped>

	My first thought would be that you should NOT be loading an entire
GB file as one chunk (for all I know, Windows low-level I/O read the
file into a OS buffer [1GB] and then tries to pass it on to the Python
memory buffer [another 1GB]... Or Python is reading in chunks -- say 1MB
at a time, and appending chunks... That means it goes "whoops, I've got
a 512MB data buffer and just read another 1MB -- better allocate a 768MB
buffer [total now is 512 + 768 + 1 => 1281MB], copy the 512MB into the
new buffer, append the 1MB, NOW free the older 512MB... You might have
the raw memory, but it may be fragmented such that the system can not
allocate a contiguous 1MB chunk).

	If .readlines() works when .read() fails, it is memory fragmentation
(each parsed line is an individual chunk of memory since the list of
lines is just a list of addresses to the lines)
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python does not take up available physical memory Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-19 18:01 -0400

csiph-web