Click here to Skip to main content
15,921,174 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: What's about the size of memory usage? Pin
Abin24-Apr-04 0:07
Abin24-Apr-04 0:07 
GeneralRe: What's about the size of memory usage? Pin
Behzad Ebrahimi24-Apr-04 1:09
Behzad Ebrahimi24-Apr-04 1:09 
GeneralRe: What's about the size of memory usage? Pin
Maximilien24-Apr-04 2:13
Maximilien24-Apr-04 2:13 
GeneralRe: What's about the size of memory usage? Pin
Abin24-Apr-04 2:18
Abin24-Apr-04 2:18 
GeneralRe: What's about the size of memory usage? Pin
Renjith Ramachandran24-Apr-04 2:26
Renjith Ramachandran24-Apr-04 2:26 
GeneralRe: What's about the size of memory usage? Pin
Maximilien24-Apr-04 5:18
Maximilien24-Apr-04 5:18 
GeneralRe: What's about the size of memory usage? Pin
Prakash Nadar24-Apr-04 5:33
Prakash Nadar24-Apr-04 5:33 
AnswerRe: What's about the size of memory usage? Pin
Paul Ranson24-Apr-04 4:54
Paul Ranson24-Apr-04 4:54 
Assuming 'global' means that my_arr is declared outside any function then the stack doesn't come into it.

What's happening is that the executable is being marked as needing more than 180M of memory and this much is reserved in the virtual address space of the process, but until you write (or read....) that memory it isn't actually allocated for real, in some cases you will never be able to have it all as real memory at once, it will be paged in and out from the pagefile as required. This is transparent apart from the slowness.

Anyway look at the 'VM Size' column in Task Manager (View->Select Columns, if necessary) I think you will find this shows a more likely amount.

I cannot explain why your program terminated abnormally unless you incorrectly accessed the array or your pagefile isn't big enough. Perhaps you could extract a small sample of the code you're using to access the array? I suspect you have an error in parameter order to that unwieldy array and are writing off the end.

Anyway the following code runs to completion and you end up with a 'mem usage' of 180M.
typedef struct{
char buff[20];
} my_struct;
my_struct my_arr[1000][30][10][10][3];

int main()
{
    for ( int a = 0; a < 1000; ++a )
        for ( int b = 0; b < 30; ++b )
            for ( int c = 0; c < 10; ++c )
                for ( int d = 0; d < 10; ++d )
                    for ( int e = 0; e < 3; ++e )
                    {
                        my_arr [ a ][ b ][ c ][ d ][ e ].buff [ 0 ] = '0' ;
                        my_arr [ a ][ b ][ c ][ d ][ e ].buff [ 19 ] = '9' ;
                    }
    return 0;
}

Paul
QuestionHow do you read a dialog template resource programmatically? Pin
Abin23-Apr-04 21:14
Abin23-Apr-04 21:14 
AnswerRe: How do you read a dialog template resource programmatically? Pin
Michael Dunn24-Apr-04 6:32
sitebuilderMichael Dunn24-Apr-04 6:32 
AnswerRe: How do you read a dialog template resource programmatically? Pin
David Crow26-Apr-04 3:16
David Crow26-Apr-04 3:16 
GeneralA dialog consisting of more than a property sheet..! Pin
Halloko23-Apr-04 20:37
Halloko23-Apr-04 20:37 
GeneralRe: A dialog consisting of more than a property sheet..! Pin
Prakash Nadar23-Apr-04 20:56
Prakash Nadar23-Apr-04 20:56 
GeneralRe: A dialog consisting of more than a property sheet..! Pin
Halloko23-Apr-04 21:32
Halloko23-Apr-04 21:32 
GeneralRe: A dialog consisting of more than a property sheet..! Pin
Prakash Nadar23-Apr-04 22:17
Prakash Nadar23-Apr-04 22:17 
GeneralRe: A dialog consisting of more than a property sheet..! Pin
Gary R. Wheeler24-Apr-04 1:53
Gary R. Wheeler24-Apr-04 1:53 
GeneralRe: A dialog consisting of more than a property sheet..! Pin
Halloko24-Apr-04 1:57
Halloko24-Apr-04 1:57 
GeneralRe: A dialog consisting of more than a property sheet..! Pin
Gary R. Wheeler27-Apr-04 14:12
Gary R. Wheeler27-Apr-04 14:12 
Generalto execute MS Dos file inside c or c++ program Pin
shiva shankar23-Apr-04 20:13
shiva shankar23-Apr-04 20:13 
GeneralRe: to execute MS Dos file inside c or c++ program Pin
l a u r e n23-Apr-04 20:58
l a u r e n23-Apr-04 20:58 
GeneralRe: to execute MS Dos file inside c or c++ program Pin
Prakash Nadar23-Apr-04 21:03
Prakash Nadar23-Apr-04 21:03 
GeneralRe: to execute MS Dos file inside c or c++ program Pin
shiva shankar23-Apr-04 22:30
shiva shankar23-Apr-04 22:30 
GeneralRe: to execute MS Dos file inside c or c++ program Pin
Renjith Ramachandran24-Apr-04 2:45
Renjith Ramachandran24-Apr-04 2:45 
QuestionHow to change folder format Pin
Member 81095323-Apr-04 20:10
Member 81095323-Apr-04 20:10 
AnswerRe: How to change folder format Pin
Renjith Ramachandran24-Apr-04 2:38
Renjith Ramachandran24-Apr-04 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.