有这样的问题
#define ROW 100 
#define COL 20
#define OUNUM 1
class CBpDlg : public CDialog
{
// Construction
public:
        void BpBackward(double INPUT[ROW][COL],int m_row);
void BpForward(double INPUT[ROW][COL],int m_row);
CBpDlg(CWnd* pParent = NULL); // standard constructor
double OUTPUT[ROW][OUNUM];       //网络输出
        double IUPUT[ROW][COL];          //网络输入
     double IdealOut[ROW][OUNUM];          //理想输出
CString Num[ROW];             //代号
_RecordsetPtr m_pRecordset;
    _ConnectionPtr m_pConnection;
------
}
当ROW定义为1-4000时都运行没错,但是当ROW定义到5000以上,运行出现stack flow
程序发生异常。请问,这是什么原因造成的,怎么解决呢?

解决方案 »

  1.   

    不是内存泄漏,同意楼上的,或者你用linker 的stack参数把你程序的stack调大点,下面是MSDN里面关于这个参数的说明
    /STACK:reserve[,commit]
    The /STACK option sets the size of the stack in bytes. This option is only for use when building an .exe file.This option specifies the total stack allocation in virtual memory. The default stack size is 1 MB. The linker rounds up the specified value to the nearest 4 bytes.commit is subject to interpretation by the operating system. In Windows NT and Windows 2000 it specifies the amount of physical memory to allocate at a time. Committed virtual memory causes space to be reserved in the paging file. A higher commit value saves time when the application needs more stack space, but increases the memory requirements and possibly the startup time.Specify the reserve and commit values in decimal or C-language notation.Another way to set the size of the stack is with the STACKSIZE statement in a module-definition (.def) file. STACKSIZE overrides the Stack Allocations (/STACK) option if both are specified. You can change the stack after the .exe file is built by using the EDITBIN tool. To set this linker option in the Visual Studio development environment Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties. 
    Click the Linker folder. 
    Click the System property page. 
    Modify one of the following properties: 
    Stack Commit Size 
    Stack Reserve Size 
      

  2.   

    缺省主程序的堆栈大小为1M,超过这个就会出现Stack OverFlow,解决方法可以使用new来分配CBpDlg* pDlg = new CBpDlg(...); 对象,而不是直接使用CBpDlg dlg;来声明。