|
[Sponsors] |
Why I can not allocate five 256*256 array in VC++ |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 29, 2000, 11:25 |
Why I can not allocate five 256*256 array in VC++
|
#1 |
Guest
Posts: n/a
|
Hi.
When I making a small CFD program, I need 5 256*256 array in calculation (single precision). However, the program run into error when execute. (for samller array everything goes OK). Is there some configuration of cmoplier I should set when I use VC++ to make large scale calculation? Thanks, Aspens, |
|
February 29, 2000, 16:27 |
Re: Why I can not allocate five 256*256 array in VC++
|
#2 |
Guest
Posts: n/a
|
5 256*256 float arrays is less than 2MB. There should be no problem allocating that amount, so you have probably made a mistake in the code. Is the allocation failing (check the return from malloc or new), or are you getting an error later?
|
|
March 1, 2000, 00:11 |
Re: Why I can not allocate five 256*256 array in VC++
|
#3 |
Guest
Posts: n/a
|
Hi. It complies and builds Ok, but when I run it, it says "unexpected ..". When I tried to step into the program, it gives me a Stack Overflow signal, and I can not even start it! I am working in VC++, is there any switch to set this stack size? Their help simply does not help.
sincerely, Apsens, |
|
March 1, 2000, 00:51 |
Re: Why I can not allocate five 256*256 array in VC++
|
#4 |
Guest
Posts: n/a
|
Check your subroutines. may be you are steping to a momery place where the divition by zero happens.
|
|
March 1, 2000, 05:06 |
Re: Why I can not allocate five 256*256 array in VC++
|
#5 |
Guest
Posts: n/a
|
It depends what you mean by allocate.
If you have five local arrays inside a function, they will normally be allocated on the stack each time the function is called. This will crash your program if the stack is too small. You can get around this by declaring them static inside the function, which will cause their storage to be allocated differently (on the heap), preventing the stack from overflowing. If you are dynamically allocating 256*256 floats and 256 float pointers to simulate each 256x256 2D array, check each malloc return value against NULL (for failure). |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
An unknown array definition in fortran | morteza08 | Main CFD Forum | 0 | June 20, 2011 05:32 |
ODETest.C Compiling failed in version 1.6 | sxhdhi | OpenFOAM Bugs | 4 | April 27, 2010 06:36 |
Tecplot Macro - conditional - array variable | pchidamb | Tecplot | 2 | July 29, 2009 10:48 |
ARRAY PASSING in STAR4 | John | Siemens | 2 | September 22, 2008 15:39 |
How to conevrt cgns file in node array for metis? | John | CFX | 0 | November 12, 2006 23:54 |