⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 findleak.txt

📁 开源的nasm编译器源码,研究编译器原理很有帮且
💻 TXT
字号:
Subject: [nasm-devel] tool to help find memory leaksDate: Fri, 02 Nov 2001 22:08:01 -0500From: Ed Beroset <beroset@mindspring.com>Reply-To: nasm-devel@yahoogroups.comTo: nasm-devel@yahoogroups.comHere's a little Perl script I wrote a while ago to help track down memoryleaks in nasm.  First, compile nasm with LOGALLOC defined (seenasmlib.c).  That creates a log file of all allocs and frees.  This Perlscript reads that file and tells you which source code lines caused a leak(or a free of unallocated memory).  There are many leaks, almost all ofthem in the preprocessor.-+--- findleak.pl begins#!/usr/bin/perlmy %mem = {};my %alloc = {};while(<>){        if (/realloc\((0x[0-9a-f]+).*\).*returns \((0x[0-9a-f]+)/)        {                $mem{$1}--;                if ($mem{$1} != 0) {                        print "free before alloc! $_";                }                if ($mem{$2} != 0) {                        print "memory leak! $_";                }                $mem{$2}++;                $alloc{$2} = $_;        }        elsif (/free\((0x[0-9a-f]+)/)        {                $mem{$1}--;                if ($mem{$1} != 0) {                        print "free before alloc! $_";                }        }        elsif (m/returns (0x[0-9a-f]+)/)        {                if ($mem{$1} != 0) {                        print "memory leak! $_";                }                $mem{$1}++;                $alloc{$1} = $_;        }}foreach $goo (sort keys %mem){        if ($mem{$goo})        {                print "$mem{$goo} $alloc{$goo}";        }}-+--- findleak.pl endsYour use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -