fi
fi
-dnl Enable Leak Finding Functions
-AC_ARG_ENABLE(leakfinder,
- AS_HELP_STRING([--enable-leakfinder],
- [Enable Leak Finding code. Enabling this alone does nothing;
- you also have to modify the source code to use the leak
- finding functions. Probably Useful for hackers only.]), [
- SQUID_YESNO([$enableval],
- [unrecognized argument to --enable-leakfinder: $enableval])
-])
-AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
-SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
- [Enable code for assisting in finding memory leaks. Not for the faint of heart])
-AM_CONDITIONAL(ENABLE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
-
-
AC_ARG_ENABLE(follow-x-forwarded-for,
AS_HELP_STRING([--enable-follow-x-forwarded-for],
[Enable support for following the X-Forwarded-For
+++ /dev/null
-/*
- * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#ifndef _SQUID_LEAKCHECK_H
-#define _SQUID_LEAKCHECK_H
-
-#if LEAK_CHECK_MODE && 0 /* doesn't work at the moment */
-#define LOCAL_ARRAY(type,name,size) \
- static type *local_##name=NULL; \
- type *name = local_##name ? local_##name : \
- ( local_##name = (type *)xcalloc(size, sizeof(type)) )
-#else
-#define LOCAL_ARRAY(type,name,size) static type name[size]
-#endif
-
-#endif
-
/** \endcond */
#endif
-// temporary for the definition of LOCAL_ARRAY
-#include "leakcheck.h"
+#define LOCAL_ARRAY(type, name, size) static type name[size]
#endif /* SQUID_CONFIG_H */
USE_IDENT \
USE_IPV6 \
USE_KQUEUE \
- USE_LEAKFINDER \
USE_LIBCAP \
USE_LOADABLE_MODULES \
USE_MIT_KRB5 \
+++ /dev/null
-/*
- * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: section 45 Callback Data Registry */
-
-/*
- * Use these to find memory leaks
- */
-
-#include "squid.h"
-
-#if USE_LEAKFINDER
-
-#include "LeakFinder.h"
-#include "SquidTime.h"
-#include "Store.h"
-
-/* ========================================================================= */
-
-LeakFinderPtr::LeakFinderPtr(void *p, const char *f, const int l) :
- file(f),
- line(l),
- when(squid_curtime)
-{
- // XXX: these bits should be done by hash_link()
- key = p;
- next = NULL;
-}
-
-/* ========================================================================= */
-
-LeakFinder::LeakFinder() :
- count(0),
- last_dump(0)
-{
- debugs(45, 3, "LeakFinder constructed");
- table = hash_create(cmp, 1 << 8, hash);
-#if 0
- /* if this is desired to reinstate, add a
- * RegisterWithCacheManager method
- */
- cachemgrRegister("leaks",
- "Memory Leak Tracking",
- cachemgr_dump, 0, 1);
-#endif
-}
-
-void *
-LeakFinder::addSome(void *p, const char *file, int line)
-{
- assert(hash_lookup(table, p) == NULL);
- LeakFinderPtr *c = new LeakFinderPtr(p, file, line);
- hash_join(table, c);
- ++count;
- return p;
-}
-
-void *
-LeakFinder::touch(void *p, const char *file, int line)
-{
- assert(p);
- LeakFinderPtr *c = (LeakFinderPtr *) hash_lookup(table, p);
- assert(c);
- c->file = file;
- c->line = line;
- c->when = squid_curtime;
- return p;
-}
-
-void *
-LeakFinder::freeSome(void *p, const char *file, int line)
-{
- assert(p);
- LeakFinderPtr *c = (LeakFinderPtr *) hash_lookup(table, p);
- assert(c);
- hash_remove_link(table, c);
- --count;
- delete c;
- dump();
- return p;
-}
-
-/* ========================================================================= */
-
-int
-LeakFinder::cmp(const void *p1, const void *p2)
-{
- return (char *) p1 - (char *) p2;
-}
-
-unsigned int
-LeakFinder::hash(const void *p, unsigned int mod)
-{
- return ((unsigned long) p >> 8) % mod;
-}
-
-void
-LeakFinder::dump()
-{
- if (0 == count)
- return;
-
- if (squid_curtime == last_dump)
- return;
-
- last_dump = squid_curtime;
-
- debugs(45, DBG_IMPORTANT, "Tracking " << count << " pointers");
-
- hash_first(table);
-
- LeakFinderPtr *c;
-
- while ((c = (LeakFinderPtr *)hash_next(table))) {
- debugs(45, DBG_IMPORTANT, std::setw(20) << c->key << " last used " << std::setw(9) << (squid_curtime - c->when) <<
- " seconds ago by " << c->file << ":" << c->line);
- }
-}
-
-#endif /* USE_LEAKFINDER */
-
+++ /dev/null
-/*
- * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#ifndef SQUID_LEAKFINDER_H
-#define SQUID_LEAKFINDER_H
-
-#if USE_LEAKFINDER
-
-#include "hash.h"
-
-#define leakAdd(p,l) if (l) l->addSome(p,__FILE__,__LINE__)
-#define leakTouch(p,l) if (l) l->touch(p,__FILE__,__LINE__)
-#define leakFree(p,l) if (l) l->freeSome(p,__FILE__,__LINE__)
-
-class LeakFinderPtr : public hash_link
-{
-
-public:
- LeakFinderPtr(void *, const char *, const int);
- const char *file;
- int line;
- time_t when;
-};
-
-class LeakFinder
-{
-
-public:
- LeakFinder();
- ~LeakFinder();
-
- void *addSome(void *, const char *, const int);
-
- void *touch(void *, const char *, const int);
-
- void *freeSome(void *, const char *, const int);
-
- void dump();
-
-private:
- static HASHCMP cmp;
-
- static HASHHASH hash;
-
- hash_table *table;
-
- int count;
-
- time_t last_dump;
-
-};
-
-#else /* USE_LEAKFINDER */
-
-class LeakFinder {};
-
-#define leakAdd(p,l) (void)0
-#define leakTouch(p,l) (void)0
-#define leakFree(p,l) (void)0
-#endif /* USE_LEAKFINDER */
-
-#endif /* SQUID_LEAKFINDER_H */
-
HTCPSOURCE = htcp.cc htcp.h
endif
-if ENABLE_LEAKFINDER
-LEAKFINDERSOURCE = LeakFinder.cc
-else
-LEAKFINDERSOURCE =
-endif
-
if ENABLE_UNLINKD
UNLINKDSOURCE = unlinkd.h unlinkd.cc
UNLINKD = unlinkd
$(IPC_SOURCE) \
ipcache.cc \
ipcache.h \
- $(LEAKFINDERSOURCE) \
LogTags.cc \
LogTags.h \
lookup_t.h \
ipc.cc \
ipc_win32.cc \
ProfStats.cc \
- LeakFinder.cc \
- LeakFinder.h \
$(SNMP_ALL_SOURCE) \
$(UNLINKDSOURCE) \
$(WIN32_ALL_SOURCE) \
#include "Debug.h"
#include "Icmp4.h"
#include "IcmpPinger.h"
-#include "leakcheck.h"
#include "SquidTime.h"
static const char *
#include "Debug.h"
#include "Icmp6.h"
#include "IcmpPinger.h"
-#include "leakcheck.h"
#include "SquidTime.h"
// Some system headers are only neeed internally here.
--disable-pf-transparent \
--disable-linux-netfilter \
--disable-linux-tproxy \
- --disable-leakfinder \
--disable-follow-x-forwarded-for \
--disable-ident-lookups \
--disable-default-hostsfile \
--enable-select \
--enable-http-violations \
--enable-ipfw-transparent \
- --enable-leakfinder \
--enable-follow-x-forwarded-for \
--enable-ident-lookups \
--enable-default-hostsfile=/etc/hosts \
--enable-select \
--enable-http-violations \
--enable-ipfw-transparent \
- --enable-leakfinder \
--enable-follow-x-forwarded-for \
--enable-ident-lookups \
--enable-internal-dns \