Largest Array of Structures Size Question 
Author Message
 Largest Array of Structures Size Question

Does anyone know off-hand what the largest size of an array of structures
usable in a program is??

For example:

struct {
    char BandName[80];
    char CDName[80];
    char TrackName[80];
    char PathToTrack[255];
    long ByteSizeOfTrack;
    long SecondsSizeOfTrack;

Quote:
} StoredAudio[1000];

I believe would consume about 511,000 bytes of space.  How much higher could
I go???  Over a megabyte??

I'm using VC++ 6.0 here.

Thanks,
Joe



Tue, 22 Mar 2005 23:39:45 GMT  
 Largest Array of Structures Size Question
What is the largest value *you* have been able to use?


Quote:
> Does anyone know off-hand what the largest size of an array of structures
> usable in a program is??

> For example:

> struct {
>     char BandName[80];
>     char CDName[80];
>     char TrackName[80];
>     char PathToTrack[255];
>     long ByteSizeOfTrack;
>     long SecondsSizeOfTrack;
> } StoredAudio[1000];

> I believe would consume about 511,000 bytes of space.  How much higher
could
> I go???  Over a megabyte??

> I'm using VC++ 6.0 here.

> Thanks,
> Joe



Tue, 22 Mar 2005 23:48:43 GMT  
 Largest Array of Structures Size Question
You're ultimately limited only by available virtual memory, and a hard limit
at 2Gb, since that's the largest amount of user-space any process can ever
have (well, ok, 3Gb if you're on Win2k Advanced Server and boot with the
/3GB option).

In practice, an allocation of dozens of megabytes will always succeed.  Once
you get up to near (within 32meg or so) the amount of physical RAM in your
computer, the program will still "work", but probably will become unusably
slow due to virtual memory thrashing.

-cd


Quote:
> Does anyone know off-hand what the largest size of an array of structures
> usable in a program is??

> For example:

> struct {
>     char BandName[80];
>     char CDName[80];
>     char TrackName[80];
>     char PathToTrack[255];
>     long ByteSizeOfTrack;
>     long SecondsSizeOfTrack;
> } StoredAudio[1000];

> I believe would consume about 511,000 bytes of space.  How much higher
could
> I go???  Over a megabyte??

> I'm using VC++ 6.0 here.

> Thanks,
> Joe



Wed, 23 Mar 2005 00:12:02 GMT  
 Largest Array of Structures Size Question


Quote:
> Does anyone know off-hand what the largest size of an array of structures
> usable in a program is??

> For example:

> struct {
>     char BandName[80];
>     char CDName[80];
>     char TrackName[80];
>     char PathToTrack[255];
>     long ByteSizeOfTrack;
>     long SecondsSizeOfTrack;
> } StoredAudio[1000];

> I believe would consume about 511,000 bytes of space.  How much higher
could
> I go???  Over a megabyte??

Not to seem flippant, but how many do you *need*? Why not simply allocate on
the heap the amount you actually need, or use an STL vector or list to
dynamically grow as you need it?

Jay



Wed, 23 Mar 2005 00:12:35 GMT  
 Largest Array of Structures Size Question
Thanks for all the advice.  I wasn't sure if my program would automatically
be able to access virtual memory through the OS or not...

I'm not all that good at linked list dynamic memory allocation so I figure
I'd just do it the easy way...I humbly admit.  Maybe in a later version of
this personal programming project I will try the dynamic mem allocation
method.

FYI, the structures' memory requirement could go as high as 4MB in my
program.  Not much higher than that due to overall harddisk space use of the
files that the structures' are referring to.  3,000 structures will be
enough to provide information on files that will consume 100GB of disk
storage space.  Therefore, about 1.5MB of "informational structures"
necessary per 100GB of referenced files I guess.

FYI also, I've begun to store ALL of my CD collection in uncompressed WAV
format (each track is a separate file) and am writing a small app to access
and make playlists of the files much easier...  That is what this is for...

Thanks again all!
Joe


Quote:



> > Does anyone know off-hand what the largest size of an array of
structures
> > usable in a program is??

> > For example:

> > struct {
> >     char BandName[80];
> >     char CDName[80];
> >     char TrackName[80];
> >     char PathToTrack[255];
> >     long ByteSizeOfTrack;
> >     long SecondsSizeOfTrack;
> > } StoredAudio[1000];

> > I believe would consume about 511,000 bytes of space.  How much higher
> could
> > I go???  Over a megabyte??

> Not to seem flippant, but how many do you *need*? Why not simply allocate
on
> the heap the amount you actually need, or use an STL vector or list to
> dynamically grow as you need it?

> Jay



Wed, 23 Mar 2005 00:38:42 GMT  
 Largest Array of Structures Size Question

Quote:

> Thanks for all the advice.  I wasn't sure if my program would automatically
> be able to access virtual memory through the OS or not...

> I'm not all that good at linked list dynamic memory allocation so I figure
> I'd just do it the easy way...I humbly admit.  Maybe in a later version of
> this personal programming project I will try the dynamic mem allocation
> method.

> FYI, the structures' memory requirement could go as high as 4MB in my
> program.  Not much higher than that due to overall harddisk space use of the
> files that the structures' are referring to.  3,000 structures will be
> enough to provide information on files that will consume 100GB of disk
> storage space.  Therefore, about 1.5MB of "informational structures"
> necessary per 100GB of referenced files I guess.

> FYI also, I've begun to store ALL of my CD collection in uncompressed WAV
> format (each track is a separate file) and am writing a small app to access
> and make playlists of the files much easier...  That is what this is for...

> Thanks again all!
> Joe

It's not obvious (until you request more memory than the available
physical memory) but *all* of the memory your program uses is virtual
memory.  It's the only kind you can get in Windows and the OS works
pretty hard to make that happen automatically.

You won't have any problem getting 4MB, but as you can imagine using the
max-needed fixed-size allocation like this wastes memory, and disk space
if you store to file.  If you're learning programming then this is
something you should revisit later.  You can learn a lot about MFC, and
about a way to allocate the array dynamically and save/load it to a
file, by working through at least the first few steps of the SCRIBBLE
tutorial in the MFC help.

--
Scott McPhillips [VC++ MVP]



Wed, 23 Mar 2005 01:55:07 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Arrays [256][256] --- error Array size too large!

2. largest structure size on pc (in c)

3. Very large array of structures

4. the largest size of an array in C

5. array size too large

6. Array size to large

7. Array size too large

8. Array size too large?

9. TC: Array Size Too Large

10. how to use a large size array in Visual C++

11. An array in a structure Or an Array Of Structures

12. The size of the structure array

 

 
Powered by phpBB® Forum Software