help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

large arrays - how to store?


From: Paul Schneider
Subject: large arrays - how to store?
Date: Tue, 01 Feb 2005 10:18:15 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20041227)

Hello,

for my program I need a large multidimensional array the dimensions of which I know at compile time. Specifically it is of size 500 x 5000 x 10 x 6. I am looking for guidance of how to treat this array on a linux system with 2 Gigs of memory.

1) Should I use stack memory? I have heard that it is hard to detect stack overflows, however g++ doesn't give me any warnings with -Wall and -fstack-check gives me a seg fault. This is what I'm doing now and the program seems to run just fine.

2) Should I declare it static?

3) Should I use dynamically allocated memory?

I will have to use the fourth dimension (the one with 6 elements) in lots of Matrix.Vector Vector.Vector products. Ironically I am currently using blitz::TinyVector<blitz::TinyVector<blitz::TinyVector<blitz::TinyVector<double, 6>, 10>, 5000>, 500>, since I have read that BLAS is slow on small vectors and blitz seems to do a good job inlining.

Is there a better (faster, safer) way of how to handle such a large datastructure?

Thanks for your experience,

PS


reply via email to

[Prev in Thread] Current Thread [Next in Thread]