Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*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; 'completeness': 0.07; 'parameter': 0.07; 'python': 0.09; '32-bit': 0.09; 'buffer,': 0.09; 'chunks': 0.09; 'construed': 0.09; 'fails.': 0.09; 'friday,': 0.09; 'ide': 0.09; 'parsed': 0.09; 'windows,': 0.09; 'subject:not': 0.11; 'read.': 0.13; '(there': 0.16; '4gb': 0.16; 'buy,': 0.16; 'low-level': 0.16; 'oct': 0.16; 'solicitation': 0.16; 'message-----': 0.17; 'tries': 0.17; 'memory': 0.18; 'windows': 0.19; 'to:name:python-list@python.org': 0.20; 'file.': 0.20; 'trying': 0.21; 'purposes': 0.23; 'task': 0.23; 'to:2**1': 0.23; "i've": 0.23; 'pass': 0.25; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'setting': 0.26; 'older': 0.27; 'raw': 0.27; '2.3': 0.27; 'accuracy': 0.27; 'reflect': 0.27; 'lines': 0.28; 'appending': 0.29; 'i/o': 0.29; 'statements': 0.29; 'url:mailman': 0.29; '(including': 0.30; 'fri,': 0.30; 'law.': 0.30; 'url:python': 0.32; 'file': 0.32; 'addresses': 0.32; 'suggestion': 0.32; 'running': 0.32; 'skip:- 10': 0.32; 'url:listinfo': 0.32; 'comments': 0.33; 'goes': 0.33; 'material': 0.33; 'allocated': 0.33; 'loading': 0.33; 'profit': 0.33; 'substantial': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'likely': 0.33; 'hi,': 0.33; 'another': 0.33; 'version': 0.34; "can't": 0.34; 'thanks': 0.34; 'server': 0.35; 'list': 0.35; 'follows:': 0.35; 'there': 0.35; 'really': 0.36; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'october': 0.37; 'does': 0.37; 'why': 0.37; '(for': 0.37; 'sent:': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'some': 0.38; 'received:10': 0.38; 'shows': 0.38; 'advice': 0.39; 'performance': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'url:mail': 0.40; 'address': 0.60; 'most': 0.61; 'materials': 0.61; 'first': 0.61; 'received:network': 0.61; 'free': 0.61; 'received:216': 0.62; 'interest': 0.62; 'time,': 0.62; 'email name:python-list': 0.62; 'necessarily': 0.63; 'information': 0.63; 'offering': 0.64; 'within': 0.64; 'results': 0.65; 'management': 0.65; 'notified': 0.65; 'offer': 0.65; 'subject': 0.66; 'reliance': 0.66; 'investment': 0.67; 'fund': 0.67; 'income': 0.67; 'contact': 0.68; 'physical': 0.69; 'funds': 0.78; 'disclosure,': 0.78; '(each': 0.84; '1gb': 0.84; '512': 0.84; 'comparable': 0.84; 'dennis': 0.91; 'investor': 0.93; 'subject:available': 0.96 X-Env-Sender: pradipto.banerjee@adainvestments.com X-Msg-Ref: server-5.tower-131.messagelabs.com!1350685385!27416552!1 X-Originating-IP: [216.166.12.97] X-StarScan-Received: X-StarScan-Version: 6.6.1.3; banners=-,-,- X-VirusChecked: Checked From: Pradipto Banerjee To: Dennis Lee Bieber , "python-list@python.org" Date: Fri, 19 Oct 2012 17:22:15 -0500 Subject: RE: Python does not take up available physical memory Thread-Topic: Python does not take up available physical memory Thread-Index: Ac2uRgWyYMXLoAsNSLqUqXak32HXSQAAe2HQ References: <76D03718A3233B4C8CC236C169B535B5A23E063E45@AUSP01VMBX08.collaborationhost.net> <9oi388heolcjt1es6em5f9c93q73cranbh@invalid.netcom.com> In-Reply-To: <9oi388heolcjt1es6em5f9c93q73cranbh@invalid.netcom.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 93 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350685389 news.xs4all.nl 6840 [2001:888:2000:d::a6]:44300 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31781 Dennis, 1. Yes, .readlines() work where .read() fails. Thanks for the suggestion - = this has really given a big boost to the size of the data I can read. 2. Yes, I am running the python interpretation within the IDE (Spyder). Thanks -----Original Message----- From: Python-list [mailto:python-list-bounces+pradipto.banerjee=3Dadainvest= ments.com@python.org] On Behalf Of Dennis Lee Bieber Sent: Friday, October 19, 2012 6:01 PM To: python-list@python.org Subject: Re: Python does not take up available physical memory On Fri, 19 Oct 2012 12:08:53 -0500, Pradipto Banerjee 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 avail= able physical memory when I was trying to read the file. I tried to read th= e 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 s= etting or preferences? > > I am using python(x,y) distribution (python 2.7) and use Spyder as the ID= E. > Are you /running/ from within the IDE -- such that the Python interpreter is considered part of the IDE address space? 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 =3D> 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 fragmentatio= n (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/ -- http://mail.python.org/mailman/listinfo/python-list This communication is for informational purposes only. It is not intended = to be, nor should it be construed or used as, financial, legal, tax or inve= stment advice or an offer to sell, or a solicitation of any offer to buy, a= n interest in any fund advised by Ada Investment Management LP, the Investm= ent advisor. Any offer or solicitation of an investment in any of the Fund= s may be made only by delivery of such Funds confidential offering material= s to authorized prospective investors. An investment in any of the Funds i= s not suitable for all investors. No representation is made that the Funds= will or are likely to achieve their objectives, or that any investor will = or is likely to achieve results comparable to those shown, or will make any= profit at all or will be able to avoid incurring substantial losses. Perf= ormance results are net of applicable fees, are unaudited and reflect reinv= estment of income and profits. Past performance is no guarantee of future = results. All financial data and other information are not warranted as to c= ompleteness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of = Ada Investment Management LP and its affiliates. This transmission may cont= ain information that is confidential, legally privileged, and/or exempt fro= m disclosure under applicable law. If you are not the intended recipient, y= ou are hereby notified that any disclosure, copying, distribution, or use o= f the information contained herein (including any reliance thereon) is stri= ctly prohibited. If you received this transmission in error, please immedia= tely contact the sender and destroy the material in its entirety, whether i= n electronic or hard copy format.