title: warning C6262: Function uses '27688' bytes of stack: exceeds /analyze:stacksize '16384'. Consider moving some data to heap
body: <p>I have read a few questions and topics on this issue. For example:</p>
  
  <p><a href="https://stackoverflow.com/questions/23269406/warning-message-regarding-stack-size">Warning message regarding stack size</a></p>
  
  <p>But I can't really work out how I am to isolate the issue in the method:</p>
  
  <pre><code>void CCreateReportDlg::ReadOptions()
  {
      CHeadingsDlg            dlgHeadings(this);
      COptionsDlg             dlgOptions(this);
      CBrothersDlg            dlgBrothers(this, FALSE);
      CAutoAssignSettingsDlg  dlgAssign(this);
      CString                 strSection = theApp.GetActiveScheduleSection(_T("Options"));
  
      // headings
      m_strReportTitle = dlgHeadings.GetReportTitle();
      dlgHeadings.GetHeadings(m_aryStrHeading);
  
      m_eReportMode = dlgOptions.GetReportMode();
  
      // brother data
      dlgBrothers.GetBrotherData(SOUND, m_aryStrSoundWT, m_aryStrSoundSM, TRUE);
      dlgBrothers.GetBrotherData(PLATFORM, m_aryStrPlatformWT, m_aryStrPlatformSM, TRUE);
      dlgBrothers.GetBrotherData(MIKE, m_aryStrMikeWT, m_aryStrMikeSM, TRUE);
      dlgBrothers.GetBrotherData(ATTENDANT, m_aryStrAttendWT, m_aryStrAttendSM, TRUE);
      dlgBrothers.GetBrotherData(SOUND, m_aryStrBroSoundAll, TRUE);
      dlgBrothers.GetBrotherData(PLATFORM, m_aryStrBroPlatformAll, TRUE);
      dlgBrothers.GetBrotherData(MIKE, m_aryStrBroMikeAll, TRUE);
      dlgBrothers.GetBrotherData(ATTENDANT, m_aryStrBroAttendAll, TRUE);
  
      CCustomAssignManagerDlg::GetCustomAssignData(m_aryPtrAssign, TRUE, ASSIGN_SORT_HEADING);
  
      if(m_eReportMode != MODE_MEETING)
      {
          // We need to update the arrays to only include the brothers that are available
          // on both days (so the two arrays become identical)
          ModifyBrotherArrays();
      }
  
      dlgBrothers.GetBrotherData(m_cbBrother);
  
      // We need an array of unique names
      // (without first to entries in combo)
      // Used during printing and exporting (multi highlight)
      dlgBrothers.GetBrotherData(m_aryStrNames);
      CBrothersDlg::SortArray(m_aryStrNames);
  
      // options
      m_bExcludePlatformColumn = dlgOptions.ExcludePlatformColumn();
      m_bExcludePlatformMikeColumn = dlgOptions.ExcludePlatformMikeColumn();
      m_bExcludeAttendColumn = dlgOptions.ExcludeAttendantColumn();
  
      m_iNumMikeUsers = dlgOptions.GetNumMikeUsers();
      m_iNumSoundUsers = dlgOptions.GetNumSoundUsers();
      m_iNumAttendUsers = dlgOptions.GetNumAttendants();
  
      dlgOptions.GetMeetingDays(m_iDayWT, m_iDaySM, m_iDayWeek);
      m_iDayWT++;
      m_iDaySM++;
      m_iDayWeek++;
  
      dlgOptions.GetCustomDateOptions(m_bCustomDate, m_strDateFormat);
  
      m_bAvoidBack2Back = dlgAssign.AvoidBack2Back();
      m_bCheckForConflicts = dlgAssign.CheckForConflicts();
      m_bSelectNames = dlgAssign.SelectNames();
  
      theApp.ReadDateMapData(m_mapSPtrBroDates);
  
      m_bShowNotes = (BOOL)theApp.GetNumberSetting(strSection, _T("ShowNotes"), (int)TRUE);
      m_bNoticeBoard = (BOOL)theApp.GetNumberSetting(strSection, _T("NoticeBoard"), (int)FALSE);
  
      dlgOptions.ReadAssignStatesInfoEx(m_byAryAutoAssignStates);
  }
  </code></pre>
  
  <p>I know I can adjust the compiler and increase the stacksize to supress the error.</p>
  
  <p>But what is the basic approach to identifying the route cause in my method?</p>
  
  <p>The first bunch of variables are <code>CStringArray</code>. Then it is followed by a <code>CPtrArray</code> of objects, of type <code>CUSTOM_ASSIGN_S</code>:</p>
  
  <pre><code>typedef struct tagCustomAssignment
  {
      int     iIndex;
      CString     strDescription;
      CString     strHeading;
      BOOL        bExcluded;
      CStringArray    aryStrBrothersAll;
      CStringArray    aryStrBrothersWT;
      CStringArray    aryStrBrothersSM;
  
      BOOL        bIncludeWT;
      BOOL        bIncludeTMS;
  
      BOOL        bFixed;
      int     iFixedType;
  
  } CUSTOM_ASSIGN_S;
  </code></pre>
  
  <p>Again, none of the members of the above structure are large arrays <code>[xxx]</code>. The only other notable method is <code>ReadDateMapData</code> that reads an archive and fills another map.</p>
  
  <p>But as mentioned, I don't know how to go about isolating the issue. There are no large arrays being define. One or two <code>TCHAR file[_MAXPATH];</code> but that is about it. The rest of classes like <code>CStringArray</code> or <code>CPtrArray</code> etc..</p>
  
  <p>Thank you in advance.</p>
  
  <h2>Update</h2>
  
  <p>Based on the comments provided I was able to establish that even just the variable declarations at the top:</p>
  
  <pre><code>CHeadingsDlg            dlgHeadings(this);
  COptionsDlg             dlgOptions(this);
  CBrothersDlg            dlgBrothers(this, FALSE);
  CAutoAssignSettingsDlg  dlgAssign(this);
  CString                 strSection = theApp.GetActiveScheduleSection(_T("Options"));
  </code></pre>
  
  <p>Would cause it to have a stack size of 18072 to begin with.</p>