|
|
Up |
|
|
  |
Author: Paul van DelstPaul van Delst Date: Sep 5, 2008 08:09
Hello,
I have a bunch of derived types that contain pointer arrays. In the course of their use
the structures get allocated, copied, destroyed, reallocated, extended, etc.
I test for memory leaks in a rather brain dead way - I call the routines in my test code
many 10's of 1000's of times with top running in another window so I can keep an eye on
the memory usage. If it increases steadily, I have a leak.
But, I was wondering if anyone out there had any smarter ideas for testing this? Needing
to run top alongside doesn't make for a very easy to use test.
Thanks for any ideas.
cheers,
paulv
|
| |
|
| | 7 Comments |
|
  |
Author: rusi_pathanrusi_pathan Date: Sep 5, 2008 08:44
On Sep 5, 11:09 am, Paul van Delst noaa.gov> wrote:
> Hello,
>
> I have a bunch of derived types that contain pointer arrays. In the course of their use
> the structures get allocated, copied, destroyed, reallocated, extended, etc.
>
> I test for memory leaks in a rather brain dead way - I call the routines in my test code
> many 10's of 1000's of times with top running in another window so I can keep an eye on
> the memory usage. If it increases steadily, I have a leak.
>
> But, I was wondering if anyone out there had any smarter ideas for testing this? Needing
> to run top alongside doesn't make for a very easy to use test.
>
> Thanks for any ideas.
>
> cheers,
>
> paulv
|
| |
|
| | no comments |
|
  |
Author: rusi_pathanrusi_pathan Date: Sep 5, 2008 09:16
On Sep 5, 11:44 am, rusi_pathan gmail.com> wrote:
> On Sep 5, 11:09 am, Paul van Delst noaa.gov> wrote:
>
>
>
>> Hello,
>
>> I have a bunch of derived types that contain pointer arrays. In the course of their use
>> the structures get allocated, copied, destroyed, reallocated, extended, etc.
>
>> I test for memory leaks in a rather brain dead way - I call the routines in my test code
>> many 10's of 1000's of times with top running in another window so I can keep an eye on
>> the memory usage. If it increases steadily, I have a leak.
>
>> But, I was wondering if anyone out there had any smarter ideas for testing this? Needing
>> to run top alongside doesn't make for a very easy to use test.
>
>> Thanks for any ideas.
>
>> cheers, ...
|
| Show full article (1.45Kb) |
| no comments |
|
  |
Author: George TrojanGeorge Trojan Date: Sep 5, 2008 09:31
Paul van Delst wrote:
> Hello,
>
> I have a bunch of derived types that contain pointer arrays. In the
> course of their use the structures get allocated, copied, destroyed,
> reallocated, extended, etc.
>
> I test for memory leaks in a rather brain dead way - I call the routines
> in my test code many 10's of 1000's of times with top running in another
> window so I can keep an eye on the memory usage. If it increases
> steadily, I have a leak.
>
> But, I was wondering if anyone out there had any smarter ideas for
> testing this? Needing to run top alongside doesn't make for a very easy
> to use test.
>
> Thanks for any ideas.
>
> cheers,
> ...
|
| Show full article (1.03Kb) |
| no comments |
|
  |
Author: Paul van DelstPaul van Delst Date: Sep 5, 2008 10:15
Paul van Delst wrote:
> Hello,
>
> I have a bunch of derived types that contain pointer arrays. In the
> course of their use the structures get allocated, copied, destroyed,
> reallocated, extended, etc.
>
> I test for memory leaks in a rather brain dead way - I call the routines
> in my test code many 10's of 1000's of times with top running in another
> window so I can keep an eye on the memory usage. If it increases
> steadily, I have a leak.
>
> But, I was wondering if anyone out there had any smarter ideas for
> testing this? Needing to run top alongside doesn't make for a very easy
> to use test.
>
> Thanks for any ideas.
Apologies for replying to my own post, but our news server has been very spotty of late so
I haven't received any replies locally and have been checking google groups.
|
| Show full article (1.89Kb) |
| no comments |
|
  |
Author: JayBeeJayBee Date: Sep 5, 2008 10:20
On 2008-09-05, Paul van Delst noaa.gov> wrote:
> Hello,
>
> I have a bunch of derived types that contain pointer arrays. In the course of their use
> the structures get allocated, copied, destroyed, reallocated, extended, etc.
>
> I test for memory leaks in a rather brain dead way - I call the routines in my test code
> many 10's of 1000's of times with top running in another window so I can keep an eye on
> the memory usage. If it increases steadily, I have a leak.
>
> But, I was wondering if anyone out there had any smarter ideas for testing this? Needing
> to run top alongside doesn't make for a very easy to use test.
>
> Thanks for any ideas.
Like rusi_pathan already mentioned, if you're on Linux valgrind is
double plus awesome. The downside is that it slows down the program a
lot, so you probably need to run it with some small test data set rather
than production input.
|
| Show full article (0.92Kb) |
| no comments |
|
  |
Author: Gib BogleGib Bogle Date: Sep 6, 2008 12:44
JayBee wrote:
> On 2008-09-05, Paul van Delst noaa.gov> wrote:
>> Hello,
>>
>> I have a bunch of derived types that contain pointer arrays. In the course of their use
>> the structures get allocated, copied, destroyed, reallocated, extended, etc.
>>
>> I test for memory leaks in a rather brain dead way - I call the routines in my test code
>> many 10's of 1000's of times with top running in another window so I can keep an eye on
>> the memory usage. If it increases steadily, I have a leak.
>>
>> But, I was wondering if anyone out there had any smarter ideas for testing this? Needing
>> to run top alongside doesn't make for a very easy to use test.
>>
>> Thanks for any ideas.
>
> Like rusi_pathan already mentioned, if you're on Linux valgrind is
> double plus awesome. The downside is that it slows down the program a
> lot, so you probably need to run it with some small test data set rather
> than production input. ...
|
| Show full article (0.97Kb) |
| no comments |
|
  |
|
|
  |
Author: Jan VorbrüggenJan Vorbrüggen Date: Sep 8, 2008 00:31
> But, I was wondering if anyone out there had any smarter ideas for
> testing this? Needing to run top alongside doesn't make for a very easy
> to use test.
Another alternative is to use a malloc() implementation that does
garbage collection. I have once used an early version of the Sun
compiler that contained such (from a company called Great Circle, IIRC).
It had a web-based interface that showed you statistics, including some
about memory leaks. For anything but trivial programs, its use was
required - the RTL implementation had too many leaks that would
otherwise have stopped the running program.
The advantage of garbage collection over approaches such as VALGRIND are
that they introduce no additional overhead compared to doing without.
Jan
|
| |
| no comments |
|
|