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


Groups > comp.programming > #8117

Re: Number of times a function is called

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.programming
Subject Re: Number of times a function is called
Date Mon, 23 Oct 2017 00:41:37 +0100
Organization A noiseless patient Spider
Lines 19
Message-ID <877evmlphq.fsf@bsb.me.uk> (permalink)
References <osj1d6$12nk$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain
Injection-Info reader02.eternal-september.org; posting-host="4b8ab8980509ed6d938b1841655a4921"; logging-data="23252"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nqLD859QFY73mxRvLidoJc9qr3W/+OrQ="
Cancel-Lock sha1:6qrTVwSwKKwKeG9rIue7kQPePzU= sha1:gNWkwP5+hVaAn+g5I/RyV5UCXIw=
Xref csiph.com comp.programming:8117

Show key headers only | View raw


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.

Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web