memleak.pl revision 15a44745412679c30a6d022733925af70a38b715
074e084f68dd0b08686612bec695a0cfe249da6dml#!/usr/bin/perl
074e084f68dd0b08686612bec695a0cfe249da6dml#
074e084f68dd0b08686612bec695a0cfe249da6dml# Copyright (C) 1999, 2000 Internet Software Consortium.
074e084f68dd0b08686612bec695a0cfe249da6dml#
074e084f68dd0b08686612bec695a0cfe249da6dml# Permission to use, copy, modify, and distribute this software for any
074e084f68dd0b08686612bec695a0cfe249da6dml# purpose with or without fee is hereby granted, provided that the above
074e084f68dd0b08686612bec695a0cfe249da6dml# copyright notice and this permission notice appear in all copies.
074e084f68dd0b08686612bec695a0cfe249da6dml#
074e084f68dd0b08686612bec695a0cfe249da6dml# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
074e084f68dd0b08686612bec695a0cfe249da6dml# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
074e084f68dd0b08686612bec695a0cfe249da6dml# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
074e084f68dd0b08686612bec695a0cfe249da6dml# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
074e084f68dd0b08686612bec695a0cfe249da6dml# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
074e084f68dd0b08686612bec695a0cfe249da6dml# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
074e084f68dd0b08686612bec695a0cfe249da6dml# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
074e084f68dd0b08686612bec695a0cfe249da6dml# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
074e084f68dd0b08686612bec695a0cfe249da6dml
074e084f68dd0b08686612bec695a0cfe249da6dml# $Id: memleak.pl,v 1.8 2000/07/27 09:54:54 tale Exp $
074e084f68dd0b08686612bec695a0cfe249da6dml
074e084f68dd0b08686612bec695a0cfe249da6dml# Massage the output from ISC_MEM_DEBUG to extract mem_get() calls
074e084f68dd0b08686612bec695a0cfe249da6dml# with no corresponding mem_put().
074e084f68dd0b08686612bec695a0cfe249da6dml
074e084f68dd0b08686612bec695a0cfe249da6dml$mem_stats = '';
074e084f68dd0b08686612bec695a0cfe249da6dml
074e084f68dd0b08686612bec695a0cfe249da6dmlwhile (<>) {
074e084f68dd0b08686612bec695a0cfe249da6dml $gets{$1.$2} = $_ if (/mem_get\((?:0x)?([0-9a-f]+), (?:0x)?[0-9a-f]+\) -> (?:0x)?([0-9a-f]+)/);
074e084f68dd0b08686612bec695a0cfe249da6dml delete $gets{$1.$2} if /mem_put\((?:0x)?([0-9a-f]+), (?:0x)?([0-9a-f]+), (?:0x)?[0-9a-f]+\)/;
074e084f68dd0b08686612bec695a0cfe249da6dml $mem_stats .= $_ if /\d+ gets, +(\d+) rem/ && $1 > 0;
074e084f68dd0b08686612bec695a0cfe249da6dml}
074e084f68dd0b08686612bec695a0cfe249da6dmlprint join('', values %gets);
074e084f68dd0b08686612bec695a0cfe249da6dmlprint $mem_stats;
074e084f68dd0b08686612bec695a0cfe249da6dml
074e084f68dd0b08686612bec695a0cfe249da6dmlexit(0);
074e084f68dd0b08686612bec695a0cfe249da6dml