Bug 90345 - Kompare 3.3 crashes on a big diff file
Summary: Kompare 3.3 crashes on a big diff file
Alias: None
Product: kompare
Classification: Applications
Component: parser (show other bugs)
Version: 3.3
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Kompare developers
Depends on:
Reported: 2004-09-27 20:53 UTC by Rafael J. Wysocki
Modified: 2007-12-19 10:14 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Rafael J. Wysocki 2004-09-27 20:53:03 UTC
Version:           3.3 (using KDE KDE 3.3.0)
Installed from:    SuSE RPMs
Compiler:           x86-64
OS:                Linux

Kompare consistently crashes when feeded with the file that is available at http://www.sisk.pl/kernel/040927/2.6.9-rc2-mm1-to-mm2.patch.gz (gzipped).  The relevant backtrace is available at http://www.sisk.pl/kde/040927/kompare-crash.log.
Comment 1 Otto Bruggeman 2004-10-02 20:16:35 UTC
I can confirm this, everytime a file in the diff is parsed there is 65k allocated for the levenstein table, but i had a hitcount of around 14000 parsed files before i ran out of memory (1 GB in my laptop) I dont think there are 14000 files in that diff but anyway i'll have to release the tables because afterwards i dont use them anyway. But the 14000 allocations indicate a different bug in the parser which needs to be fixed. Cant find this one yet, give me a few more days (missed the 3.3.1 deadline so you'll have to wait until 3.3.2 or use the patch that i'll attach here as soon as i have a fix and then recompile kompare).
Comment 2 Jeff Snyder 2005-06-06 21:43:29 UTC
This is gonna be a little spammy... I'm reassigning everything that's currently 
assigned to bruggie (who's been the default assignee for bugs since time began) 
to the new list address. 
Bruggie: if you're working on one or more of these atm, please snatch 'em 
Everyone, esp. Joshua and Bruggie: if this genrates 33 mails, my sincere 
Comment 3 Jeff Snyder 2005-08-09 11:02:54 UTC
SVN commit 444219 by je4d:

put the levenstein table on the stack, not the heap, and hence only allocate mem for it when needed, rather than having 65k*(number of files) allocated all the time.
BUG: 90345
CCMAIL: bruggie@home.nl

 M  +4 -10     difference.cpp  
 M  +1 -1      difference.h  

--- branches/KDE/3.5/kdesdk/kompare/libdiff2/difference.cpp #444218:444219
@@ -26,14 +26,12 @@
 	m_type( type ),
 	m_sourceLineNo( sourceLineNo ),
 	m_destinationLineNo( destinationLineNo ),
-	m_applied( false ),
-	m_table( new LevenshteinTable() )
+	m_applied( false )
-	delete m_table;
 void Difference::addSourceLine( QString line )
@@ -63,6 +61,7 @@
 void Difference::determineInlineDifferences()
+	LevenshteinTable table;
 	if ( m_type != Difference::Change )
@@ -80,15 +79,10 @@
 		DifferenceString* dl = destinationLineAt( i );
 		// FIXME: If the table cant be created dont do the rest
-		m_table->createTable( sl, dl );
+		table.createTable( sl, dl );
-		m_table->createListsOfMarkers();
+		table.createListsOfMarkers();
-	// No longer needed, if we ever need to recalculate the inline differences we should
-	// simply recreate the table
-	delete m_table;
-	m_table = 0;
 QString Difference::recreateDifference() const
--- branches/KDE/3.5/kdesdk/kompare/libdiff2/difference.h #444218:444219
@@ -210,7 +210,7 @@
 	bool                  m_applied;
 	bool                  m_conflicts;
-	LevenshteinTable*     m_table;
+	LevenshteinTable*     m_tableXXX; // now unused
 typedef QValueList<Difference*> DifferenceList;
Comment 4 Kevin Kofler 2007-12-19 10:14:29 UTC
SVN commit 750441 by kkofler:

put the levenstein table on the stack, not the heap, and hence only allocate mem for it when needed, rather than having 65k*(number of files) allocated all the time.
CCBUG: 90345
(forward-port rev 444219 by je4d from 3.5 branch)

 M  +4 -10     difference.cpp  
 M  +0 -2      difference.h  

WebSVN link: http://websvn.kde.org/?view=rev&revision=750441