Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #8115 > unrolled thread

Number of times a function is called

Started byVictor Porton <porton@narod.ru>
First post2017-10-23 00:08 +0300
Last post2017-10-23 00:41 +0100
Articles 3 — 3 participants

Back to article view | Back to comp.programming


Contents

  Number of times a function is called Victor Porton <porton@narod.ru> - 2017-10-23 00:08 +0300
    Re: Number of times a function is called Robert Wessel <robertwessel2@yahoo.com> - 2017-10-22 16:19 -0500
    Re: Number of times a function is called Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-10-23 00:41 +0100

#8115 — Number of times a function is called

FromVictor Porton <porton@narod.ru>
Date2017-10-23 00:08 +0300
SubjectNumber of times a function is called
Message-ID<osj1d6$12nk$1@gioia.aioe.org>
For debugging purposes,

I need to check that my program calls functions xxx_alloc() and xxx_free() 
from a (dynamic or static) library the same number of times (every 
allocation is followed by exactly one deallocation).

How to do this on Linux?

-- 
Victor Porton - http://portonvictor.org

[toc] | [next] | [standalone]


#8116

FromRobert Wessel <robertwessel2@yahoo.com>
Date2017-10-22 16:19 -0500
Message-ID<mp2quchfkfs8prsnkmmn4nme1tp7kpdfmc@4ax.com>
In reply to#8115
On Mon, 23 Oct 2017 00:08:46 +0300, Victor Porton <porton@narod.ru>
wrote:

>For debugging purposes,
>
>I need to check that my program calls functions xxx_alloc() and xxx_free() 
>from a (dynamic or static) library the same number of times (every 
>allocation is followed by exactly one deallocation).
>
>How to do this on Linux?


If you're looking to detect/identify memory leaks, I'd suggest looking
at Valgrind.

[toc] | [prev] | [next] | [standalone]


#8117

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2017-10-23 00:41 +0100
Message-ID<877evmlphq.fsf@bsb.me.uk>
In reply to#8115
Victor Porton <porton@narod.ru> writes:

> For debugging purposes,
>
> I need to check that my program calls functions xxx_alloc() and xxx_free() 
> from a (dynamic or static) library the same number of times (every 
> allocation is followed by exactly one deallocation).

If these functions do allocations you might find valgrind useful.

If you want to count the actual calls (without instrumenting the source)
you can use gprof(1) and the -pg flag to gcc.

> How to do this on Linux?

You might get more advice in comp.unix.programmer

-- 
Ben.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming


csiph-web