mirror of
				https://github.com/sqlite/sqlite.git
				synced 2025-10-31 18:11:01 +03:00 
			
		
		
		
	(Oops. This check-in also picked up some unrelated changes to documentation.) (CVS 2175) FossilOrigin-Name: 586acc85b170f84d6e0dbd2e293da19551242f5a
		
			
				
	
	
		
			30 lines
		
	
	
		
			513 B
		
	
	
	
		
			Awk
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			513 B
		
	
	
	
		
			Awk
		
	
	
	
	
	
| #
 | |
| # This script looks for memory leaks by analyzing the output of "sqlite" 
 | |
| # when compiled with the SQLITE_DEBUG=2 option.
 | |
| #
 | |
| /[0-9]+ malloc / {
 | |
|   mem[$6] = $0
 | |
| }
 | |
| /[0-9]+ realloc / {
 | |
|   mem[$8] = "";
 | |
|   mem[$10] = $0
 | |
| }
 | |
| /[0-9]+ free / {
 | |
|   if (mem[$6]=="") {
 | |
|     print "*** free without a malloc at",$6
 | |
|   }
 | |
|   mem[$6] = "";
 | |
|   str[$6] = ""
 | |
| }
 | |
| /^string at / {
 | |
|   addr = $4
 | |
|   sub("string at " addr " is ","")
 | |
|   str[addr] = $0
 | |
| }
 | |
| END {
 | |
|   for(addr in mem){
 | |
|     if( mem[addr]=="" ) continue
 | |
|     print mem[addr], str[addr]
 | |
|   }
 | |
| }
 |