473,473 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Large 2D Array Problem

Hi,

I have the following problem, I have used the boost library (
boost::multi_array<float,2>) of size X by X. I initialise this using the
following line

typedef boost::multi_array<float, 2> array_type;
array_type D(boost::extents[num_vertices][num_vertices]);

This works fine up to a size of 5000 x 5000 then my program crashes at
the definition stage due to memory requirements. I am assuming the
boost::extents call stops my program creating a multi array of a size
bigger than 5000 x 5000. However in certain situations I need a bigger
2D array, any thoughts on how I can achieve this?

Adam
Mar 24 '06 #1
1 2244
* Adam Hartshorne:
Hi,

I have the following problem, I have used the boost library (
boost::multi_array<float,2>) of size X by X. I initialise this using the
following line

typedef boost::multi_array<float, 2> array_type;
array_type D(boost::extents[num_vertices][num_vertices]);

This works fine up to a size of 5000 x 5000 then my program crashes at
the definition stage due to memory requirements. I am assuming the
boost::extents call stops my program creating a multi array of a size
bigger than 5000 x 5000. However in certain situations I need a bigger
2D array, any thoughts on how I can achieve this?


You are probably allocating the array as a local variable.

That's 25 million floats, probably 100 million bytes, locally.

First, think about whether you really need an array that large, or at
all. It is typical for this question that the array isn't actually
needed. If, against expectation, it turns out to be needed, try to
allocate the array dynamically instead, using 'new', and keep in mind
how much memory you have, and that it's just a very very short step to
the case where instead you should be dealing with disk storage.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Mar 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
I am using PHP 4.3.5. I am having a problem in which my script is crashing when it is using a large array. I have simplified the problem down to the following example: <? set_time_limit(0);...
6
by: guillaume | last post by:
I have to read and process a large ASCII file containing a mesh : a list of points and triangles. The file is 100 MBytes. I first tried to do it in memory but I think I am running out of memory...
2
by: xain | last post by:
HtmlString includes a web page, and soon it is converted to Html file. In the web page, they are images, and some of them are large. They are so large, in fact they are going to destroy my Tables,...
0
by: Marc van Boven | last post by:
I'm stuck with the following problem: My nusoap-client calls a server-function giveCombination(). The function giveCombination should return something like array( => array( 'a_id' => 6,...
5
by: apm | last post by:
Any and all: Is there an efficient way to pass a large array from .NET to COM? Can references (or pointer) be passed from COM to NET and NET to COM without the object it refers to being copied?...
3
by: meltedown | last post by:
Normally, if I use $result=print_r($array,TRUE); print_r prints nothing and $result is equal to the readable array. However, if $array is very large, print_r prints the array and returns...
7
by: ultr | last post by:
I need a large 3D array of structures: struct s { char a; int b; }; s s_array; s_array is declared as global.
11
by: shreesh | last post by:
I want to use an array of size greater than ARRAY but am getting an array size too large error. I am using a BC 3.1 on msdos ver 5.1.2600 on XP. How can i get around this simple but irritating...
16
by: danieleghisi | last post by:
Hello I'm writing a small programme to look for some particular integer sets (homometric sets), and each one of this sets is a unsigned long long (e.g. {1, 2, 4, 7} --1001011=75). I need to have...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.