have a nice day!
valerie99
Posts
-
locate the memory adress -
locate the memory adressThanks for your reply. I have problem setting them up, it has message box says "Cannot set the breakpoint when "0x00FE55A0" (length: 1)changed". not sure why, It should be the valid adreee, because it's the leak report says 1305 bytes leak from. and I could see the 0x00FE54D0 in somewhere....thank you!
-
locate the memory adressgood morning, all Is there a way to locate certain memory address in app during the debug? say, I wanna find out 0x00FE55A0 is using by who? the reason is memory leak, I kinda know which class is leaking, but I couldn't see where exactly it is, there is FE5420 is using by m_pValid, but it got deleted when it close down. so the FE55A0 should be somwhere near by, but I never really find it. thanks for your time!
-
the memory leakgood afternoon, could anyone see where is the leak from? thank you! I've checked the momory allocation, the leak is happening around here: strcpy( FileName, BinPath ); strcat( FileName, "CALLSM" ); strcat( FileName, Cycle); strcat( FileName, ".BIN" ); if ( _access ( FileName, 0 ) != 0 ) { sprintf( ErrorText, "File does not exist -> %s", FileName ); Message( ErrorText, VD_ERROR ); return 0; } m_information_line = "Loading CALLSUM Binary File."; PostUpdate(); CallSumBin = new CALLSUM_BIN( FileName ); if ( !CallSumBin ) { Message( "Unable to allocate CallSumBin binfile.", VD_ERROR ); return 0; } here is the delete in closedown() function: if ( CallSumBin ) { if ( !IsStop() ) { strcpy( FileName, BinPath ); strcat( FileName, "CALLSM" ); strcat( FileName, Cycle); strcat( FileName, ".BIN" ); m_information_line = "Saving updated CALLSM binary file"; PostUpdate(); CallSumBin->Save( FileName ); fprintf( Report,"Updated CALLSM binary file saved.\r\n" ); } delete CallSumBin; } m_information_line = " "; PostUpdate(); -- modified at 17:23 Wednesday 2nd November, 2005
-
Cannot create a file when that file already exists?good afternoon, all I tried to debug this app who has memory leak. when I place the "@ERR,hr" on the watch window - which works same as "int test = GetLastError();", I got this meassage "0x000000b7 Cannot create a file when that file already exists", when the app is over this line: BillMaster = new billmstr; if I clicked F5 or F10 it will let me keep going on debug, but what exactly is this messages mean? billmaster is already exists? thanks.
-
print blank pagesgood morning, anybody has experience with this? the report is txt file, everything looks just fine, but when send it to print, between some pages it would print blank pages, it didn't miss any info, but between 2&3, 3&4, 4&5 it "insert" empty page into. I have check the form feet and everything on txt file, it looks fine. here is the print job: if ( nPageNo > 1 ) m_Rpt->rptMessage( "\f" ); // form feed... m_Rpt->rptMessage( m_strOrientCPI ); //do line drawings, detail headers, etc. if ( nFirstGrpChg != -1 ) { checkForNewPage( true ); drawBottomLine(); doDetailSummary(); drawBottomLine(); checkForNewPage( false, nFirstGrpChg ); if ( m_nCurrentPageLine == 0 ) doHeaders(); else { //if not a new page, still need a seperator line fprintf(pf_rptlog,"\n" ); m_nCurrentPageLine++; } //call formatData here to correct witdth after footer and headers strOut = formatData( pszData, delimiter, 0, true ); while( nFirstGrpChg < m_nDrillDownLevels ) { drawTopLine( ( nFirstGrpChg + 1 ) ); fprintf(pf_rptlog,"%s\n",doBoinks( vholdDataHdr[nFirstGrpChg], (nFirstGrpChg + 1) ).c_str() ); m_nCurrentPageLine++; nFirstGrpChg++; } drawTopLine(); doDetailHeader(); drawMiddleLine(); } else { checkForNewPage( true ); if ( m_nCurrentPageLine == 0 ) { doHeaders(); //include firstpages stuff in here nFirstGrpChg = checkGroupHeaders( vholdDataHdr, pszData, delimiter ); loadFormat( m_currentFmt ); //this will set correct with for first grp on first page strOut = formatData( pszData, delimiter, 0, true ); if ( nFirstGrpChg != -1 ) { while( nFirstGrpChg < m_nDrillDownLevels ) { drawTopLine( ( nFirstGrpChg + 1 ) ); fprintf(pf_rptlog,"%s\n",doBoinks( vholdDataHdr[nFirstGrpChg], (nFirstGrpChg + 1) ).c_str() ); m_nCurrentPageLine++; nFirstGrpChg++; } } drawTopLine(); doDetailHeader(); drawMiddleLine(); } else { strOut = formatData( pszData, delimiter, 0, true ); } } m_bFirstGrpLine = false; if ( m_nFrameGroup != -1 ) { strOut = doBoinks( strOut ); //getBoink() + strOut + getBoink(); } fprintf(pf_rptlog,"%s\n",strOut.c_str() ); m_nCurrentPageLine++; if ( m_nCurrentPageLine == ( m_nPageLength - 1 ) ) doFooter();
-
the momory leakbecause the "NumberofGroups = this->GetContributoryAmounts (mainPos); " will call the "Groups = new GROUPSTRUCT[NumberofGroups]; ", so it's actually not trying to access right after deleting, here is the flow: if ( Groups ) { delete[] Groups; Groups = NULL; } NumberofGroups = this->GetContributoryAmounts (mainPos); Groups = new GROUPSTRUCT[NumberofGroups]; for ( i = 0; i < NumberofGroups; i++ ) { Discount->GetGroup( Groups[i].GroupID ); Groups[i].TotalContributory = 0.0; } for ( i = 0; i < NumberofGroups; i++ ) { DiscountData->GroupID = Groups[i].GroupID; DiscountData->TotalContributory = Groups[i].TotalContributory;
-
the momory leakthanks for your reply. if I step into the program, it's actually working by this float: if ( Groups ) { delete[] Groups; Groups = NULL; } NumberofGroups = this->GetContributoryAmounts (mainPos); Groups = new GROUPSTRUCT[NumberofGroups]; for ( i = 0; i < NumberofGroups; i++ ) { Discount->GetGroup( Groups[i].GroupID ); Groups[i].TotalContributory = 0.0; } for ( i = 0; i < NumberofGroups; i++ ) { DiscountData->GroupID = Groups[i].GroupID; DiscountData->TotalContributory = Groups[i].TotalContributory;
-
the momory leakthanks. here is the memory leak report. when I clicked the first line it brings to "Groups = new GROUPSTRUCT[NumberofGroups];", I think it's becaue of "you are accessing Groups[i] after Groups has already been deleted", strangly no access violation. :\dev\c++\billing\voldisc\voldiscdlg.cpp(1702) : {839} normal block at 0x00FE58F0, 16 bytes long. Data: < > 01 00 00 00 CD CD CD CD 00 00 00 00 00 00 00 00 {465} normal block at 0x00FE5230, 1309 bytes long. Data:
48 65 61 64 65 72 20 4C 65 6E 67 74 68 3A 20 30 {460} normal block at 0x00FC28B8, 60 bytes long. Data: < a 0R > 04 EA 61 00 30 52 FE 00 1D 05 00 00 1D 05 00 00 {210} normal block at 0x00FBDB80, 14844 bytes long. Data: <5 a > 35 00 00 00 90 D2 61 00 98 81 13 00 00 00 00 00 {209} normal block at 0x00FBDB28, 20 bytes long. Data: 42 49 4C 4C 44 41 54 41 5C 56 54 41 58 30 32 2E {208} normal block at 0x00FBDAC0, 36 bytes long. Data: < a 5 ( > B8 CC 61 00 35 00 00 00 28 DB FB 00 98 81 13 00 Object dump complete. So the major leak is {210} normal block at 0x00FBDB80, 14844 bytes long. Data: <5 a > 35 00 00 00 90 D2 61 00 98 81 13 00 00 00 00 00 , which I couldn't get there by clicking on, so I placed this line _CrtSetBreakAlloc(210); to set a user break point, here is the call stack when the breakpoint taken effect. _heap_alloc_dbg(unsigned int 14844, int 1, const char * 0x00000000, int 0) line 338 _nh_malloc_dbg(unsigned int 14844, int 0, int 1, const char * 0x00000000, int 0) line 248 + 21 bytes _malloc_dbg(unsigned int 14844, int 1, const char * 0x00000000, int 0) line 165 + 27 bytes operator new(unsigned int 14844) line 325 + 15 bytes CB::Open(const char * 0x00e29f69, int 0) line 915 + 27 bytes CB::CB(const char * 0x00e29f69, int 0) line 883 CB_DBF::CB_DBF(const char * 0x00e29f69, int 0) line 269 + 45 bytes OpenDbfHelper(const char * 0x00e29f69) line 93 + 40 bytes OpenDbf(CB_DBF * * 0x0064acf0 class CB_DBF * VTax, const char * 0x00e29f69, int & 0, std::basic_string,std::allocator > * 0x00fafdcc {0x00000000 ""}) line 46 + 9 bytes CVoldiscDlg::OpenDBFs() line 838 + 27 bytes Run(void * 0x0012fd5c) line 2557 + 8 bytes _AfxThreadEntry(void * 0x0012f6cc) line 112 + 13 bytes _threadstartex(void * 0x00e24b90) line 212 + 13 bytes KERNEL32! 7c57b388() could u give me some help about how to nerrow down where the leak starts? thank you !
-
the momory leakGood afternoon, the app detected memory leak at this point: Groups = new GROUPSTRUCT[NumberofGroups]; for ( i = 0; i < NumberofGroups; i++ ) { Discount->GetGroup( Groups[i].GroupID ); Groups[i].TotalContributory = 0.0; } and here is the delete: if ( Groups ) { delete[] Groups; Groups = NULL; } NumberofGroups = this->GetContributoryAmounts (mainPos); for ( i = 0; i < NumberofGroups; i++ ) { DiscountData->GroupID = Groups[i].GroupID; DiscountData->TotalContributory = Groups[i].TotalContributory; Is this the proper delete? thanks!
-
pad zero in front of long value?I think this shouldn't been done as long since it's for display not conculation, leading zero is meaningful at this point. I could left pad zero in front of string, long city = ( party.getCityCode() == 0 ? Long.parseLong( t.toString() ) : party.getCityCode() ); String szcity = utils.leftPadZeros( String.valueOf( city ), t.length()); long token = cintCity.find2( szCountry, szcity ); but the whole app is using long for citycode, it might cause problem later on party.setCityCode( city ); so I was wondering if I could pad zero in front of long....seems like impossible... thanks, have a good weekend
-
pad zero in front of long value?thanks, David. I need that 0 because it's the phone number, 0123 is different as 123.......thanks for your help.
-
pad zero in front of long value?thanks, David. I need that 0 because it's the phone number, 0123 is different as 123 in some country's city code.......thanks for your help.
-
pad zero in front of long value?morning, when the string got convert to long, it lost the leading zero, could it just be padded back or it should be converted back to string to add the zero? here is the code, sorry, it's java String t = party.getNumber().getNNxx(); t = rightTrim( t.substring( offset, t.length() ) ); while( t.length() > 0 ) { long city = ( party.getCityCode() == 0 ? Long.parseLong( t.toString() ) : party.getCityCode() ); t = t.substring( 0, t.length()-1 ); String szCountry = Long.toString( party.getCountry() ); long token = cintCity.find( (long) party.getCountry(), city ); if ( token != cintCity.end() ) { party.setCityCode( city ); thanks. -- modified at 12:08 Friday 21st October, 2005
-
delete m_pdbf in destruction?hi, all when this app open the customer dbf file, it creats index as well, it didn't really has m_pdbf = new...., but it seems like need to be deleted in dbCustomer::~dbCustomer(), here is the steps: BOOL dbCustomer::Open( const char *pszFileName, bool bReindex ) { ASSERT( m_pdbf == NULL ); int nError = 0; std::string strErrMsg = ""; if ( !OpenDbfNtx( &m_pdbf, pszFileName, NULL, NULL, nError, &strErrMsg ) ) throw DbfAccessException (string(pszFileName) + " not found", RC_DBF_UNABLE_TO_OPEN); SetIndex( pszFileName, m_pdbf, bReindex ); m_pdbf->set_order( "CUSNUM02" ); return BindFieldOrdinals(); } CB_DBF_NTX* const p = OpenDbfNtxHelper( szDbfName, szIndexName, szIndexKey ); CB_DBF_NTX* pDbf = new CB_DBF_NTX( const_cast( szDbfName ) ); the wrapper seems conplicated, it's getting infor from library files.........thanks for your time
-
any good assembly language links?hi, all I am trying to understand why the app crashes, lots of time it bring up the Disassembly and it's totally just out of my lead....could anybody share some good assembly language links, I just need to understand the basic assembly commends...thank you for your time
-
CDialog::OnCancel or postmessage(wm_cancel)thanks for your reply. what happened was everything goes well in debug, but it crashes when it called onCancle() in release mode with access violation. I couldn't figure out why it that, by the way, is there a outline for when to use onCancle and when for postmessage()? and for the UNICODE, what is sign for UNICODE inside of a function? thanks again!
-
CDialog::OnCancel or postmessage(wm_cancel)hi, all I kinda fixed the issue but still not sure what's wrong with the previous method. it was having access violation at this point: void CSurchrgDlg::Exit() { if( !m_bCanceled ) { ..... } CDialog::OnCancel(); } now I used "PostMessage( cDlg->GetSafeHwnd(), WM_QUIT, 0, 0 );" replaced the exit funtion at the end of RUN. seems to work. OR I used PostMessage(WM_QUIT); to replace CDialog::OnCancel(); would work, too. could someone tell me what's wrong with the calling the CDialog::OnCancel();? Thank you for your time!
-
The thread 0x6B8 has exited with code 2 (0x2).Good afternoon I got this message for the app after finished debug: The thread 0x6B8 has exited with code 2 (0x2). The program 'C:\DEV\C++\Billing\Report\Debug\Report.exe' has exited with code 2 (0x2). the 0x6B8 thread is CDialog::OnCancel, the part of code that calling OnCancel is from here: LRESULT CReportDlg::OnComplete( WPARAM, LPARAM ) { m_thrReport.Wait( INFINITE ); PostMessage( WM_CLOSE ); return S_OK; } Is it because of infinite waiting causing exited with code 2? what is code 2 mean? thank you!
-
warning C4503but after I enabled the /EHsc option in project setting, I still get 14 same warnings.......not sure why is that. Thank you for your time