# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
}
}
-my $maxmem;
+my $memsum; # the total number of memory allocated over the lifetime
+my $maxmem; # the high water mark
sub newtotal {
my ($newtot)=@_;
$sizeataddr{$addr}=$size;
$totalmem += $size;
+ $memsum += $size;
if($trace) {
print "MALLOC: malloc($size) at $source:$linenum",
$sizeataddr{$addr}=$size;
$totalmem += $size;
+ $memsum += $size;
if($trace) {
print "CALLOC: calloc($arg1,$arg2) at $source:$linenum",
$sizeataddr{$oldaddr}=0;
$totalmem += $newsize;
+ $memsum += $size;
$sizeataddr{$newaddr}=$newsize;
if($trace) {
$sizeataddr{$addr}=$size;
$totalmem += $size;
+ $memsum += $size;
if($trace) {
printf("STRDUP: $size bytes at %s, makes totally: %d bytes\n",
$sizeataddr{$addr}=$size;
$totalmem += $size;
+ $memsum += $size;
if($trace) {
printf("WCSDUP: $size bytes at %s, makes totally: %d bytes\n",
"Operations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups + $sends + $recvs + $sockets)."\n";
print "Maximum allocated: $maxmem\n";
+ print "Total allocated: $memsum\n";
}