I have removed includes not connected with Qt (windows.h, map, vector ),
i use only includes started with Q. I use QFile instead of CreateFile etc...

When i enter the code below, and make breakpoint on some line, when it break,
then I hit F10 and program suspends... 100% CPU, +500MB memory used and
growing...

And don't know what is wrong.
Before mentioned function i open the file, allocate 8MB memory on heap for
file data, and close the file ...

any suggestions ?


Qt Code:
  1. bool LogFileAnalizer::BuildTransactionVector( QString& error )
  2. {
  3. // clear previous data
  4. _transactions.clear();
  5.  
  6. // constants used
  7. const Char BeginMark = _pVersion->GetBeginMark();
  8. const Char EmptyMark = _pVersion->GetEmptyMark();
  9. const Char EmptyMemoryId = _pVersion->GetUnusedMemTransactionId();
  10. const Char WrongMemoryId = _pVersion->GetWrongMemoryTransactionId();
  11. const Char RootBeginId = 0x35; //!! hardcoded, change later
  12. const Char RootEndId = 0x38; //!! hardcoded, change later
  13. const Char RootContId = 0x39; //!! hardcoded, change later -> works like RootEndId
  14. const Int MinEmptyDataSize = 128; // minimum continous empty mark size to treat it as empty space (not trans param) !! hardcoded - change later
  15.  
  16. // data pointers
  17. Char* fileBegin = _data; // file begin
  18. Char* fileEnd = _data + _fileSize; // file end
  19. Char* dataBegin = 0; // transactions data begin - to find
  20. Char* dataEnd = 0; // transactions data end - to find
  21.  
  22. // cursors
  23. Char* pos = _data; // position to go through buffer
  24. Char* end = _data + _fileSize; // buffer end postion
  25.  
  26. // FIND EMPTY BUFFER END TRANSACTION ENTRY BEGIN AND END
  27. // go to first transaction
  28. while(( *pos != BeginMark && pos < end ) || (( pos + 1 ) < end && *pos == BeginMark && *( ++pos ) == BeginMark )) // second condition skips double BeginMark which means a normal data
  29. {
  30. ++pos;
  31. }
  32. ....
To copy to clipboard, switch view to plain text mode