|
From: Mark S. <mar...@ap...> - 2006-05-02 09:35:43
|
Hi, A few months ago I was given with a similar task, and decided mempools were the best course of action. I would create and destroy mempools as SHM was attached and detached from the process. The program would then use its own memory allocation from the shared memory, so VALGRIND_MEMPOOL_ALLOC and VALGRIND_MEMPOOL_FREE were used where needed. At the time memcheck would not leak-check mempools so I needed a patch by Robert Walsh (mempool.diff at http://valgrind.org/downloads/variants.html?rjw) and then had to create my own patch on top of that (http://www.markshinn.co.uk/valgrind/mempoolleakcheck.patch). Its a few months since I did this, so the latest release may handle mempools fully - I last worked on this on 13/01/06, so I can't say how my patch will cope with the current SVN head. This could be more complex than you require, but I hope it helps... Mark Mark Shinn Software Engineer=20 www.apertio.com=20 Mob: +44 7971 651 139=20 mar...@ap...=20 Tel: +44 117 906 1120 Fax: +44 117 906 1130=20 Apertio Limited, St Luke's House, Emerson Way, Emersons Green, Bristol = BS16 7AR This email and any files transmitted with it are confidential and = intended solely for the use of the individual or entity to whom they are = addressed. Please notify pos...@ap... if you have received = this e-mail by mistake and delete this e-mail from your system. Please = note that any views or opinions presented in this email are solely those = of the author and do not necessarily represent those of Apertio Ltd. = WARNING: Computer viruses can be transmitted via email. The recipient = should check this email and any attachments for the presence of viruses. = Although scanning is performed on all outgoing mail, Apertio Ltd accepts = no liability for any damage caused by any virus transmitted by this = email. -----Original Message----- Message: 2 Date: Fri, 28 Apr 2006 10:55:48 +0100 From: Bryan Meredith <om...@br...> To: M Mohan-A19706 <mo...@mo...> CC: val...@li... Subject: Re: [Valgrind-users] Is valgrind capable of checking leaks for shared memory. Hi, at a guess, I would say that running your programs as two threads in a=20 single process and marking the shared memory pointer with=20 MALLOCLIKE_BLOCK and then FREELIKE_BLOCK when you free it could well be=20 what you are looking for. See the docs and valgrind.h for the macros you need. You may also want to have a look at my omega tool:=20 http://www.brainmurders.eclipse.co.uk/omega.html but it is still in beta. The choice is yours. hope this helps, Bryan "Brain Murders" Meredith M Mohan-A19706 wrote: > Hi All, >=20 > I have two application where one process allocates shared memory and > other process uses it and free the memory vica-versa. >=20 > Does valgrind support here to check for memory leaks? >=20 > Basically if valgrind supports checking leaks for shared memory then I > can start these two process as single process with two different threads > to test leaks. >=20 > Please help me here. >=20 > Thanks > Mohan M >=20 >=20 > |