Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Python does not take up available physical memory

Reply
Thread Tools

Re: Python does not take up available physical memory

 
 
Emile van Sebille
Guest
Posts: n/a
 
      10-20-2012
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 = 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Python does not take up available physical memory Pradipto Banerjee Python 6 10-21-2012 02:14 PM
RE: Python does not take up available physical memory Pradipto Banerjee Python 1 10-19-2012 09:37 PM
RE: Python does not take up available physical memory Prasad, Ramit Python 0 10-19-2012 07:17 PM
Re: Python does not take up available physical memory MRAB Python 0 10-19-2012 07:13 PM
Re: Python does not take up available physical memory Ian Kelly Python 0 10-19-2012 06:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57