From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 28 17:40:12 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F107AC7A for ; Mon, 28 Jul 2014 17:40:11 +0000 (UTC) Received: from mail-vc0-x22d.google.com (mail-vc0-x22d.google.com [IPv6:2607:f8b0:400c:c03::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B32F82901 for ; Mon, 28 Jul 2014 17:40:11 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id hy10so11659215vcb.4 for ; Mon, 28 Jul 2014 10:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ImHtG9xVk6PnzNm3hwEDAR7FwU3g5rj3vqmFAAssy/k=; b=GArCPEvMG8yj8is+CQwWzpWHgef2nHv+KYz90JpGcETHfWhO4n6L8u8WxTz9rR02NK P9lIc7Vl9CFlTzZh2SBEPZkNH9Ab07APqMrOznsafs2nfaQAqGthbfeF17pPkxMSeTiF rTkPuy8kPiuTvcY0bmbUj7r5uHIoF2wZ50DYyGQM+aFeTUWdoVxLNcwQukVDUPADrrk+ XVuvo3rzvjmLMY2ExH/g5ZDInDeLpD/QTo4h/9LZ9Mtfve0NeHvSCYQhNZgMdzJBpUqw 04gElgTz5YUYMINZMnT49GJCgVIB0yEElt2/3wG+UB1ULcep8EwfTbCgbKEIAiAhMJKd s64g== MIME-Version: 1.0 X-Received: by 10.52.147.15 with SMTP id tg15mr8742488vdb.53.1406569210737; Mon, 28 Jul 2014 10:40:10 -0700 (PDT) Received: by 10.220.192.68 with HTTP; Mon, 28 Jul 2014 10:40:10 -0700 (PDT) Date: Mon, 28 Jul 2014 13:40:10 -0400 Message-ID: Subject: Allocation/free history From: suresh gumpula To: freebsd-hackers@freebsd.org X-Mailman-Approved-At: Mon, 28 Jul 2014 19:10:34 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 17:40:12 -0000 Hi, Knowing the PC of an allocation is very usefull in debugging. Having the PC hash table and storing the pc hash either with an object itself( at the end) or allocate an exra structure to hold the hash index help us find out who/where an object was allocated. We already have something like this in our own operating system and has been a useful thing in debugging. BSD allocator uses power of 2, so storing at the end of an object might be wasting lot of memory with large objects. It appears we don=E2=80=99t have something like this in current FBSD codeli= ne and would like to work on this ? Any comments please? It would be something like below. 8 bytes at the end of each object has fecepost which is usefull in finding overwrites and 2 hash indices to the PC table to track allocation history. (kgdb-amd64-7.4-87) x/40w 0xffffff153728b038 0xffffff153728b038: 0xf6970a05 0x06cb7e0c 0x305a134a 0x831c18bb 0xc0000bed 0x134a2115 0xffffff153728b050: 0x85687ef8 0xffffffff 0x00000001 0x83192201 0xc0000bed 0x1741143b Thanks Suresh