2

この問題に関するいくつかの質問とトピックを読みました。例えば:

スタックサイズに関する警告メッセージ

しかし、メソッドで問題を特定する方法を実際に理解することはできません:

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);
}

コンパイラを調整し、スタックサイズを増やしてエラーを抑制できることはわかっています。

しかし、私の方法でルートの原因を特定するための基本的なアプローチは何ですか?

変数の最初の束はCStringArray. CPtrArray次に、タイプ の オブジェクトのが続きCUSTOM_ASSIGN_Sます。

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;

繰り返しますが、上記の構造体のメンバーはどれも大きな配列ではありません[xxx]。他の唯一の注目すべき方法はReadDateMapData、アーカイブを読み取り、別のマップを埋めることです。

しかし、前述のように、問題を特定する方法がわかりません。定義されている大きな配列はありません。1つか2つTCHAR file[_MAXPATH];ですが、それはそれについてです。CStringArrayまたはなどの残りのクラスCPtrArray..

前もって感謝します。

アップデート

提供されたコメントに基づいて、上部の変数宣言だけでも次のことを確認できました。

CHeadingsDlg            dlgHeadings(this);
COptionsDlg             dlgOptions(this);
CBrothersDlg            dlgBrothers(this, FALSE);
CAutoAssignSettingsDlg  dlgAssign(this);
CString                 strSection = theApp.GetActiveScheduleSection(_T("Options"));

そもそもスタック サイズが 18072 になります。

4

1 に答える 1

1

このクラスの私の主な変数は、実際にdialogは、すべてのメンバー変数などのために当然のことながら非常に大きいオブジェクトでした..

これらのダイアログを使用した理由は、パブリック メソッドを使用してアプリケーション設定にアクセスするためでした。

これらのダイアログ宣言をnew/に変更deleteし、コードを調整することで、スタック サイズの警告が表示されなくなりました。

void CCreateReportDlg::ReadOptions()
{
    CHeadingsDlg *pDlgHeadings = new CHeadingsDlg(this);
    if (pDlgHeadings != NULL)
    {
        m_strReportTitle = pDlgHeadings->GetReportTitle();
        pDlgHeadings->GetHeadings(m_aryStrHeading);

        delete pDlgHeadings;
    }

    COptionsDlg *pDlgOptions = new COptionsDlg(this);
    if (pDlgOptions != NULL)
    {
        m_eReportMode = pDlgOptions->GetReportMode();
        m_bExcludePlatformColumn = pDlgOptions->ExcludePlatformColumn();
        m_bExcludePlatformMikeColumn = pDlgOptions->ExcludePlatformMikeColumn();
        m_bExcludeAttendColumn = pDlgOptions->ExcludeAttendantColumn();
        m_iNumMikeUsers = pDlgOptions->GetNumMikeUsers();
        m_iNumSoundUsers = pDlgOptions->GetNumSoundUsers();
        m_iNumAttendUsers = pDlgOptions->GetNumAttendants();

        pDlgOptions->ReadAssignStatesInfoEx(m_byAryAutoAssignStates);
        pDlgOptions->GetCustomDateOptions(m_bCustomDate, m_strDateFormat);

        pDlgOptions->GetMeetingDays(m_iDayWT, m_iDaySM, m_iDayWeek);
        m_iDayWT++;
        m_iDaySM++;
        m_iDayWeek++;

        delete pDlgOptions;
    }

    CBrothersDlg *pDlgBrothers = new CBrothersDlg(this, FALSE);
    if (pDlgBrothers != NULL)
    {
        pDlgBrothers->GetBrotherData(SOUND, m_aryStrSoundWT, m_aryStrSoundSM, TRUE);
        pDlgBrothers->GetBrotherData(PLATFORM, m_aryStrPlatformWT, m_aryStrPlatformSM, TRUE);
        pDlgBrothers->GetBrotherData(MIKE, m_aryStrMikeWT, m_aryStrMikeSM, TRUE);
        pDlgBrothers->GetBrotherData(ATTENDANT, m_aryStrAttendWT, m_aryStrAttendSM, TRUE);
        pDlgBrothers->GetBrotherData(SOUND, m_aryStrBroSoundAll, TRUE);
        pDlgBrothers->GetBrotherData(PLATFORM, m_aryStrBroPlatformAll, TRUE);
        pDlgBrothers->GetBrotherData(MIKE, m_aryStrBroMikeAll, TRUE);
        pDlgBrothers->GetBrotherData(ATTENDANT, m_aryStrBroAttendAll, TRUE);
        pDlgBrothers->GetBrotherData(m_cbBrother);

        // We need an array of unique names (without first two entries in combo)
        // Used during printing and exporting (multi highlight)
        pDlgBrothers->GetBrotherData(m_aryStrNames);
        CBrothersDlg::SortArray(m_aryStrNames);

        delete pDlgBrothers;
    }

    CAutoAssignSettingsDlg *pDlgAssign = new CAutoAssignSettingsDlg(this);
    if (pDlgAssign != NULL)
    {
        m_bAvoidBack2Back = pDlgAssign->AvoidBack2Back();
        m_bCheckForConflicts = pDlgAssign->CheckForConflicts();
        m_bSelectNames = pDlgAssign->SelectNames();

        delete pDlgAssign;
    }

    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();
    }

    theApp.ReadDateMapData(m_mapSPtrBroDates);

    CString strSection = theApp.GetActiveScheduleSection(_T("Options"));

    m_bShowNotes = (BOOL)theApp.GetNumberSetting(strSection, _T("ShowNotes"), (int)TRUE);
    m_bNoticeBoard = (BOOL)theApp.GetNumberSetting(strSection, _T("NoticeBoard"), (int)FALSE);
}
于 2016-12-26T18:42:46.810 に答える