CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Why I can not allocate five 256*256 array in VC++

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 29, 2000, 11:25
Default Why I can not allocate five 256*256 array in VC++
  #1
Aspens
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,
  Reply With Quote

Old   February 29, 2000, 16:27
Default Re: Why I can not allocate five 256*256 array in VC++
  #2
Chris
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?
  Reply With Quote

Old   March 1, 2000, 00:11
Default Re: Why I can not allocate five 256*256 array in VC++
  #3
Aspens
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,
  Reply With Quote

Old   March 1, 2000, 00:51
Default Re: Why I can not allocate five 256*256 array in VC++
  #4
Tareq Al-shaalan
Guest
 
Posts: n/a
Check your subroutines. may be you are steping to a momery place where the divition by zero happens.
  Reply With Quote

Old   March 1, 2000, 05:06
Default Re: Why I can not allocate five 256*256 array in VC++
  #5
Steve
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).
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 08:19.