Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'importing': 0.04; 'subject:Python': 0.05; 'memory.': 0.05; '(of': 0.07; 'completeness': 0.07; 'space.': 0.07; 'python': 0.09; 'available)': 0.09; 'construed': 0.09; 'itself.': 0.11; 'subject:not': 0.11; "'r').read()": 0.16; '(now': 0.16; '4gb': 0.16; 'buy,': 0.16; 'command,': 0.16; 'disk.': 0.16; 'solicitation': 0.16; 'somewhere.': 0.16; 'wrote:': 0.17; 'message-----': 0.17; 'resolved': 0.17; 'restrictions': 0.17; 'thanks,': 0.18; 'appears': 0.18; 'memory': 0.18; 'windows': 0.19; 'to:name:python-list@python.org': 0.20; 'file.': 0.20; 'trying': 0.21; 'error.': 0.21; 'originally': 0.23; 'purposes': 0.23; 'task': 0.23; 'to:2**1': 0.23; 'tried': 0.25; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'realize': 0.27; '2.3': 0.27; 'accuracy': 0.27; 'reflect': 0.27; "doesn't": 0.28; 'noticed': 0.28; 'run': 0.28; '>>>>': 0.29; 'attempted': 0.29; 'statements': 0.29; 'url:mailman': 0.29; 'van': 0.29; "i'm": 0.29; '(including': 0.30; 'that.': 0.30; 'law.': 0.30; 'error': 0.30; 'url:python': 0.32; 'file': 0.32; 'skip:- 10': 0.32; 'url:listinfo': 0.32; 'comments': 0.33; 'material': 0.33; 'profit': 0.33; 'substantial': 0.33; 'to:addr:python-list': 0.33; 'likely': 0.33; 'hi,': 0.33; "can't": 0.34; 'follows:': 0.35; 'similar': 0.35; 'there': 0.35; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'method': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'october': 0.37; 'does': 0.37; 'why': 0.37; 'sent:': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'received:10': 0.38; 'sure': 0.38; 'shows': 0.38; 'advice': 0.39; 'performance': 0.39; 'to:addr:python.org': 0.39; 'takes': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'url:mail': 0.40; 'real': 0.61; 'materials': 0.61; 'received:network': 0.61; 'received:216': 0.62; 'interest': 0.62; 'back': 0.62; 'email name:python-list': 0.62; 'necessarily': 0.63; 'information': 0.63; 'more': 0.63; 'offering': 0.64; 'gave': 0.65; 'results': 0.65; 'management': 0.65; 'notified': 0.65; 'offer': 0.65; '20,': 0.65; 'watching': 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; '1gb': 0.84; 'comparable': 0.84; 'investor': 0.93; 'subject:available': 0.96 X-Env-Sender: pradipto.banerjee@adainvestments.com X-Msg-Ref: server-8.tower-131.messagelabs.com!1350673462!9853472!15 X-Originating-IP: [216.166.12.69] X-StarScan-Received: X-StarScan-Version: 6.6.1.3; banners=-,-,- X-VirusChecked: Checked From: Pradipto Banerjee To: Emile van Sebille , "python-list@python.org" Date: Fri, 19 Oct 2012 14:03:37 -0500 Subject: RE: Python does not take up available physical memory Thread-Topic: Python does not take up available physical memory Thread-Index: Ac2uKmm/0BrkuZnuQeWF3B1nbpU1CQAAcZoQ References: <76D03718A3233B4C8CC236C169B535B5A23E063E45@AUSP01VMBX08.collaborationhost.net> In-Reply-To: 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: 70 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350673875 news.xs4all.nl 6982 [2001:888:2000:d::a6]:46217 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31758 Thanks, I tried that. Still got MemoryError, but at least this time python = tried to use the physical memory. What I noticed is that before it gave me = the error it used up to 1.5GB (of the 2.23 GB originally showed as availabl= e) - so in general, python takes up more memory than the size of the file i= tself. -----Original Message----- From: Python-list [mailto:python-list-bounces+pradipto.banerjee=3Dadainvest= ments.com@python.org] On Behalf Of Emile van Sebille Sent: Saturday, October 20, 2012 2:46 AM To: python-list@python.org Subject: Re: Python does not take up available physical memory On 10/19/2012 10:08 AM, Pradipto Banerjee wrote: > 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: > >>>> fdata =3D open(filename, 'r').read() > > I got a "MemoryError". I was watching the Windows Task Manager while I > run the python command, and it appears that python **perhaps** never > even attempted to use more memory but gave me this error. > > Is there any reason why python can't read a 1GB file in memory even when > a 2.3 GB physical memory is available? The real issue is likely that there is more than one copy of the file in memory somewhere. I had a similar issue years back that I resolved by using numeric (now numpy?) as it had a more efficient method of importing content from disk. Also realize that windows may not allow the full memory to user space. I'm not sure what exactly the restrictions are, but a 4Gb windows box doesn't always get you 4Gb of memory. Emile -- 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.