473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Array Size - Upper Limit

Hi,

I know that this issue is indeed strictly operating system dependent
but I am just curious:

I have a five dimensional array, whose size sums to 68 MB (almost).
This array is contained by class X. When I simply attempt to create an
instance of that class, I get segmentation fault.

I am working on Solaris (which has 8 KB pages ). What may the case be?
There seems to be an upper limit for the size of an array.

Thanks.
Dec 18 '07 #1
2 3190
D. Susman wrote:
I know that this issue is indeed strictly operating system dependent
but I am just curious:

I have a five dimensional array, whose size sums to 68 MB (almost).
This array is contained by class X. When I simply attempt to create an
instance of that class, I get segmentation fault.
What does "simply attempt to create an instance" mean? An automatic
object? Have you tried creating it dynamically?
I am working on Solaris (which has 8 KB pages ). What may the case be?
If that's an automatic object you're trying to create, your stack is
not big enough to contain it. Try increasing the stack size (usually
it is a linker option, RTFM to learn which one it's on your system).

Also, consider that putting a 68 MB stress on your stack may not be
a good idea.
There seems to be an upper limit for the size of an array.
.... but I am not certain you've reached it yet. There are other,
more severe limitations on your program, and they can be at play
here.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Dec 18 '07 #2
On Dec 18, 5:05 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
D. Susman wrote:
I know that this issue is indeed strictly operating system dependent
but I am just curious:
I have a five dimensional array, whose size sums to 68 MB (almost).
This array is contained by class X. When I simply attempt to create an
instance of that class, I get segmentation fault.
What does "simply attempt to create an instance" mean? An automatic
object? Have you tried creating it dynamically?
Or statically? Or throwing it as an exception:-)?
I am working on Solaris (which has 8 KB pages ). What may the case be?
If that's an automatic object you're trying to create, your stack is
not big enough to contain it. Try increasing the stack size (usually
it is a linker option, RTFM to learn which one it's on your system).
Usually, it's a simple command which you execute before invoking
the program. Under Solaris, "ulimit -s unlimited" should work.
(With ulimit -s set to unlimited, you can get as much stack as
you could get with dynamic allocation.)
Also, consider that putting a 68 MB stress on your stack may
not be a good idea.
Doing it once shouldn't cause any problems on a modern machine
(32 bits or more). I wouldn't suggest doing it in a lot of
different functions, which might end up calling each other, but
if there's only one instance for the life of the program,
declaring it in main is probably all right. (With a data
structure of this size, he's not going to be porting to a 16 bit
machine anyway.)
There seems to be an upper limit for the size of an array.
... but I am not certain you've reached it yet.
The formal upper limit is numeric_limits<size_t>::max(). Under
Solaris, either 4E09 or 1.8E19, depending on compiler options.
In practice, of course, the program will have to allocate memory
for it at some time, and that's likely to fail long before you
reach the formal limit (especially in the second case).
There are other, more severe limitations on your program, and
they can be at play here.
Yes. Note that even if the system accepts the allocation, if
you start accessing it randomly, cache misses will slow the
program down considerably. For even larger allocations, where
there isn't enough physical memory, page faults can slow the
system down to the point of becoming unusable. (When I test our
application here under Purify---which increases the memory
footprint significantly---, I have to terminate every other
application on the system. Otherwise, X gets paged out, and the
disk starts thrashing every time I move the cursor.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Dec 19 '07 #3

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

Similar topics

2
by: Stevio | last post by:
Is there a limit to how big you can make an array in ASP VBscript? Thanks, Stephen
10
by: Tom | last post by:
Hi I am looking for an optimal data-structure in order to replace a map<int,float>. I use it as some kind of sparse array representation. The facts: - the population in the data-structures...
12
by: Eigenvector | last post by:
I've been dinking around with this code for a while now and I can't seem to figure out where the problem lies. The original problem was that I for some reason or another couldn't allocate few...
8
by: Gerald | last post by:
I have a problem with an array of pointers. In a program I'm writing, I have to read a file, containing thousands of short lines. The content of another file will be compared against each line...
46
by: RoSsIaCrIiLoIA | last post by:
Write a function that gets an array of unsigned int fill it with random values all differents, and sorts it. It should be faster than qsort too. Do you like my solution? _______________________...
5
by: Claudio Grondi | last post by:
I have just started to play around with the bsddb3 module interfacing the Berkeley Database. Beside the intended database file databaseFile.bdb I see in same directory also the __db.001...
10
by: | last post by:
I'm fairly new to ASP and must admit its proving a lot more unnecessarily complicated than the other languages I know. I feel this is because there aren't many good official resources out there to...
26
by: MLH | last post by:
How would I modify the following to achieve a 2-dimensional array? Dim MyWeek, MyDay MyWeek = Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") ' Return values assume lower bound set to 1...
2
by: Harry | last post by:
Good Day To all, When i am declaring a array for e.g char ....it means i am declaring array of 45 characters each of which has a maximum,minimum value limit or range...for example in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.