mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08:00
supports -l now to display the actual line that was prevented by memlimit
This commit is contained in:
parent
656d4b4c20
commit
2fe5f5ab4b
@ -9,6 +9,7 @@
|
|||||||
my $mallocs=0;
|
my $mallocs=0;
|
||||||
my $reallocs=0;
|
my $reallocs=0;
|
||||||
my $strdups=0;
|
my $strdups=0;
|
||||||
|
my $showlimit;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if($ARGV[0] eq "-v") {
|
if($ARGV[0] eq "-v") {
|
||||||
@ -19,7 +20,14 @@ while(1) {
|
|||||||
$trace=1;
|
$trace=1;
|
||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
}
|
}
|
||||||
last;
|
elsif($ARGV[0] eq "-l") {
|
||||||
|
# only show what alloc that caused a memlimit failure
|
||||||
|
$showlimit=1;
|
||||||
|
shift @ARGV;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
last;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $maxmem;
|
my $maxmem;
|
||||||
@ -38,6 +46,7 @@ my $file = $ARGV[0];
|
|||||||
if(! -f $file) {
|
if(! -f $file) {
|
||||||
print "Usage: memanalyze.pl [options] <dump file>\n",
|
print "Usage: memanalyze.pl [options] <dump file>\n",
|
||||||
"Options:\n",
|
"Options:\n",
|
||||||
|
" -l memlimit failure displayed\n",
|
||||||
" -v Verbose\n",
|
" -v Verbose\n",
|
||||||
" -t Trace\n";
|
" -t Trace\n";
|
||||||
exit;
|
exit;
|
||||||
@ -45,6 +54,19 @@ if(! -f $file) {
|
|||||||
|
|
||||||
open(FILE, "<$file");
|
open(FILE, "<$file");
|
||||||
|
|
||||||
|
if($showlimit) {
|
||||||
|
while(<FILE>) {
|
||||||
|
if(/^LIMIT.*memlimit$/) {
|
||||||
|
print $_;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(FILE);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while(<FILE>) {
|
while(<FILE>) {
|
||||||
chomp $_;
|
chomp $_;
|
||||||
$line = $_;
|
$line = $_;
|
||||||
|
Loading…
Reference in New Issue
Block a user