Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. a strange debug error

a strange debug error

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gerald Mercet
    wrote on last edited by
    #1

    I have created a dialog app, which return a debug error meesage that i don't understand. This message is: Debug error Program:D:\CalcRiskPort\Debug\CalcRiskPort.exe DAMAGE: after Normal block (#81) at 0x00301190 when i pree retry i have this message box: User breakpoint called from code at 0x1021376f you could see the following code concerned void CCalcRiskPortDlg::OnCalcvar() { UpdateData(TRUE); ::CoInitialize(NULL); //LoadTables Table; //LoadTables Table2(m_dlgSector); double *pTabVar=new double[(double)pow(2,m_dlgAsset)]; double *pTabMoy=new double[(double)pow(2,m_dlgAsset)]; CString *pTabPortStr=new CString[(long)pow(2,m_dlgAsset)]; CString strValue,strPortOpti,strMaxiSharpe,strMaxiEfficience; double MiniVar,MaxiSharpe,MaxiEfficience; int Rang; double *pMiniVar=new double[2]; //double *pMiniRatio=new double[2]; double *pMaxiRatioSharpe=new double[2]; double *pMaxiRatioEfficience=new double[2]; int *pTabBinPort=new int[m_dlgAsset]; int *pTabNumPort=new int[m_dlgAsset]; int k,i; try { LoadTables Table(1,m_dlgSector,1,m_dlgSector); _ConnectionPtr pConnection=NULL; CString strTemp; strTemp.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\CalcRiskPort\\Vol&CorrelDB.mdb;"); _bstr_t strCnn(strTemp); TESTHR(pConnection.CreateInstance(__uuidof(Connection))); pConnection->Open(strCnn,"","",adConnectUnspecified); Table.pCorrel=Table.LoadCorrelation(m_dlgSector,Table.pCorrel,"Correlation"); Table.pVol=Table.LoadVolatility(m_dlgSector,Table.pVol,"Volatilité"); Table.pYield=Table.LoadYield(m_dlgSector,Table.pYield,"Ratio"); i=0; for(k=0;k<=m_dlgAsset-1;k++) { *(pTabBinPort+k)=0; Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort); } *pTabVar=Table.CalcVar(pTabNumPort,m_dlgAsset); *pTabMoy=Table.CalcMoy(pTabNumPort,m_dlgAsset); Table.pRatioSharpe[0]=(*pTabMoy)/(*pTabVar); Table.pRatioEfficience[0]=((*pTabMoy+i)-m_dlgRate0)/(*pTabVar); *pTabPortStr=Table.AgregIntToStr(pTabNumPort,m_dlgAsset); for(i=1;i<=pow(2,m_dlgAsset)-1;i++) { k=m_dlgAsset-1; while(*(pTabBinPort+k)==1) { *(pTabBinPort+k)=0; Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort); if(k!=0) k--; } *(pTabBinPort+k)=1; Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort); *(pTabVar+i)=Table.CalcVar(pTabNumPort,m_dlgAsset); *(pTabMoy+i)=Table.CalcMoy(pTabNumPort,m_dlgAsset); Table.pRatioEfficience[i]=(*(pTabMoy+i))/(*(pTabVar+i)); Table.pRatioSharpe[i]=((*

    J 1 Reply Last reply
    0
    • G Gerald Mercet

      I have created a dialog app, which return a debug error meesage that i don't understand. This message is: Debug error Program:D:\CalcRiskPort\Debug\CalcRiskPort.exe DAMAGE: after Normal block (#81) at 0x00301190 when i pree retry i have this message box: User breakpoint called from code at 0x1021376f you could see the following code concerned void CCalcRiskPortDlg::OnCalcvar() { UpdateData(TRUE); ::CoInitialize(NULL); //LoadTables Table; //LoadTables Table2(m_dlgSector); double *pTabVar=new double[(double)pow(2,m_dlgAsset)]; double *pTabMoy=new double[(double)pow(2,m_dlgAsset)]; CString *pTabPortStr=new CString[(long)pow(2,m_dlgAsset)]; CString strValue,strPortOpti,strMaxiSharpe,strMaxiEfficience; double MiniVar,MaxiSharpe,MaxiEfficience; int Rang; double *pMiniVar=new double[2]; //double *pMiniRatio=new double[2]; double *pMaxiRatioSharpe=new double[2]; double *pMaxiRatioEfficience=new double[2]; int *pTabBinPort=new int[m_dlgAsset]; int *pTabNumPort=new int[m_dlgAsset]; int k,i; try { LoadTables Table(1,m_dlgSector,1,m_dlgSector); _ConnectionPtr pConnection=NULL; CString strTemp; strTemp.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\CalcRiskPort\\Vol&CorrelDB.mdb;"); _bstr_t strCnn(strTemp); TESTHR(pConnection.CreateInstance(__uuidof(Connection))); pConnection->Open(strCnn,"","",adConnectUnspecified); Table.pCorrel=Table.LoadCorrelation(m_dlgSector,Table.pCorrel,"Correlation"); Table.pVol=Table.LoadVolatility(m_dlgSector,Table.pVol,"Volatilité"); Table.pYield=Table.LoadYield(m_dlgSector,Table.pYield,"Ratio"); i=0; for(k=0;k<=m_dlgAsset-1;k++) { *(pTabBinPort+k)=0; Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort); } *pTabVar=Table.CalcVar(pTabNumPort,m_dlgAsset); *pTabMoy=Table.CalcMoy(pTabNumPort,m_dlgAsset); Table.pRatioSharpe[0]=(*pTabMoy)/(*pTabVar); Table.pRatioEfficience[0]=((*pTabMoy+i)-m_dlgRate0)/(*pTabVar); *pTabPortStr=Table.AgregIntToStr(pTabNumPort,m_dlgAsset); for(i=1;i<=pow(2,m_dlgAsset)-1;i++) { k=m_dlgAsset-1; while(*(pTabBinPort+k)==1) { *(pTabBinPort+k)=0; Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort); if(k!=0) k--; } *(pTabBinPort+k)=1; Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort); *(pTabVar+i)=Table.CalcVar(pTabNumPort,m_dlgAsset); *(pTabMoy+i)=Table.CalcMoy(pTabNumPort,m_dlgAsset); Table.pRatioEfficience[i]=(*(pTabMoy+i))/(*(pTabVar+i)); Table.pRatioSharpe[i]=((*

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      The error is most likely due to some out-of-bounds error: your code is trying to write beyond the limits of some of your arrays. When the assertion pops up, press "Retry" to get the debugger to the point where the error showed and use the "Call stack" window to determine which buffer is being overrun. This and a little research of your write operations will hopefully locate the error. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      G 1 Reply Last reply
      0
      • J Joaquin M Lopez Munoz

        The error is most likely due to some out-of-bounds error: your code is trying to write beyond the limits of some of your arrays. When the assertion pops up, press "Retry" to get the debugger to the point where the error showed and use the "Call stack" window to determine which buffer is being overrun. This and a little research of your write operations will hopefully locate the error. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        G Offline
        G Offline
        Gerald Mercet
        wrote on last edited by
        #3

        you were right, in fact i declare a wrong memory space for only one pointer that have to be deleted by the class destructor, but there was a problem as when i put value to this pointer, i did it in a for loop, in which i would like to put more that ten times memory spacxe than i have allocated. thanks a lot gerald

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups