Article View: alt.comp.lang.learn.c-c++
Article #612Re: function question in c, please help (advanced c)
From: Pete Becker
Date: Mon, 15 Nov 1999 00:00
Date: Mon, 15 Nov 1999 00:00
31 lines
2018 bytes
2018 bytes
Sunny Rajpal wrote: > > Here is my dilemma... > I am writing a set of wrapper functions for intelligent memory > management in c. > My library will be a layer of abstraction between the programmer and > memory allocation. > We all have had problems with memory leaks and this is a solution. > My memory manager will give the program memory when it needs it and > keeps track of certain things. > It will also allow for memory pools and memory caching. > > The problem I am having is that I would like to know which user function > called my memory routines. > This will help in tracking down memory leaks, it will actually tell you > where there are possible leaks in your code. > I need to find a way to track and get information about the function > that invokes my memory manager functions. > > If anybody can help that would be great. > The usual technique is to use a macro to invoke the memory allocator: void *allocate(size_t sz, const char *file, int line); #define alloc(sz) allocate(sz, __FILE__, __LINE__) -- Pete Becker Dinkumware, Ltd. http://www.dinkumware.com
Technical Details
Message-ID:
<3830C067.84445498@acm.org>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3830B93D.A0596FCE@mediaone.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 105367,5c5819fba77f2eae X-Google-Attributes: gid105367,public X-Google-Thread: 114592,5c5819fba77f2eae X-Google-Attributes: gid114592,public X-Google-Thread: 109fba,5c5819fba77f2eae X-Google-Attributes: gid109fba,public From: Pete Becker <petebecker@acm.org> Subject: Re: function question in c, please help (advanced c) Date: 1999/11/15 Message-ID: <3830C067.84445498@acm.org> X-Deja-AN: 549102067 Content-Transfer-Encoding: 7bit References: <3830B93D.A0596FCE@mediaone.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@mediaone.net X-Trace: ndnws01.ne.mediaone.net 942719093 24.128.201.83 (Mon, 15 Nov 1999 21:24:53 EST) Organization: Dinkumware, Ltd MIME-Version: 1.0 NNTP-Posting-Date: Mon, 15 Nov 1999 21:24:53 EST Newsgroups: alt.comp.lang.learn.c-c++,cern.c++,comp.lang.c++