Newbie question about memory management

O

Oh Kyu Yoon

I am writing my first python program, and I have to deal with several lists
of double precision numbers that are about 10,000,000 in length.
If I have 5 such lists, 5 x 10,000,000 x 8bytes ~ 400 MB which is too much
for the computer memory.
Does anyone have better strategies to do this?
Thanks.
 
I

Irmen de Jong

Oh said:
I am writing my first python program, and I have to deal with several lists
of double precision numbers that are about 10,000,000 in length.
If I have 5 such lists, 5 x 10,000,000 x 8bytes ~ 400 MB which is too much
for the computer memory.
Does anyone have better strategies to do this?

Yes; keep them on disk. All of them, most of them, or partially,
you don't tell us what you're doing with the lists, and so it
is hard to guess what would be the best approach.

--Irmen.

P.S. also look at the 'array' module.
 
T

Terry Reedy

Oh Kyu Yoon said:
I am writing my first python program, and I have to deal with several lists
of double precision numbers that are about 10,000,000 in length.
If I have 5 such lists, 5 x 10,000,000 x 8bytes ~ 400 MB which is too much
for the computer memory.
Does anyone have better strategies to do this?

If you use Python lists of wrapped floats, you will use more than 8 bytes
each. To make arrays of C floats, and for much faster computation, use
Numerical Python. It includes wrappings of LinPak and FFTPak.

tjr
 
E

Emile van Sebille

Oh Kyu Yoon:
I am writing my first python program, and I have to deal with several lists
of double precision numbers that are about 10,000,000 in length.
If I have 5 such lists, 5 x 10,000,000 x 8bytes ~ 400 MB which is too much
for the computer memory.
Does anyone have better strategies to do this?

How about numeric with Kragen Sitaker's memory mapped files.
http://www.pfdubois.com/numpy/
http://pobox.com/~kragen/sw/arrayfrombuffer/

HTH,

Emile van Sebille
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top