ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Peter V. Saveliev" <peet@altlinux.ru>
To: devel@altlinux.ru
Subject: [devel] QA: socket programming - mem leaks
Date: Mon, 2 Feb 2004 20:43:58 +0300
Message-ID: <20040202204358.458634be.peet@altlinux.ru> (raw)

...

Столкнулся с неприятной штукой, при прогоне своей программы через valgrind:

8<------------------------------------------------------------------
==19598== Conditional jump or move depends on uninitialised value(s)
==19598==    at 0x11CBD6: (within /lib/ld-2.2.6.so)
8<------------------------------------------------------------------

Это вначале выполнения. Причиной является использование gethostbyname,
как показалось. Дальше - больше:

8<------------------------------------------------------------------
==19608== malloc/free: in use at exit: 672 bytes in 6 blocks.
==19608== malloc/free: 64 allocs, 58 frees, 54736 bytes allocated.
==19608== 
==19608== searching for pointers to 6 not-freed blocks.
==19608== checked 3498272 bytes.
==19608== 
==19608== 
==19608== 16 bytes in 1 blocks are definitely lost in loss record 1 of 6
==19608==    at 0x134BAA: malloc (vg_replace_malloc.c:153)
==19608==    by 0x804A1A2: main (main.c:400)
==19608==    by 0x366681: __libc_start_main (in /lib/libc-2.2.6.so)
==19608==    by 0x8048AA0: (within /home/peet/Projects/icaph/icaph)
==19608== 
==19608== 
==19608== 23 bytes in 1 blocks are still reachable in loss record 2 of 6
==19608==    at 0x134BAA: malloc (vg_replace_malloc.c:153)
==19608==    by 0x117F91: (within /lib/ld-2.2.6.so)
==19608==    by 0x11407D: (within /lib/ld-2.2.6.so)
==19608==    by 0x11532B: _dl_map_object (in /lib/ld-2.2.6.so)
==19608== 
==19608== 
==19608== 23 bytes in 1 blocks are still reachable in loss record 3 of 6
==19608==    at 0x134BAA: malloc (vg_replace_malloc.c:153)
==19608==    by 0x1156E4: _dl_map_object (in /lib/ld-2.2.6.so)
==19608==    by 0x444220: (within /lib/libc-2.2.6.so)
==19608==    by 0x119A45: _dl_catch_error (in /lib/ld-2.2.6.so)
==19608== 
==19608== 
==19608== 28 bytes in 1 blocks are still reachable in loss record 4 of 6
==19608==    at 0x134BAA: malloc (vg_replace_malloc.c:153)
==19608==    by 0x118CD6: _dl_map_object_deps (in /lib/ld-2.2.6.so)
==19608==    by 0x4442B4: (within /lib/libc-2.2.6.so)
==19608==    by 0x119A45: _dl_catch_error (in /lib/ld-2.2.6.so)
==19608== 
==19608== 
==19608== 128 bytes in 1 blocks are still reachable in loss record 5 of 6
==19608==    at 0x13503A: calloc (vg_replace_malloc.c:284)
==19608==    by 0x11AC13: _dl_check_map_versions (in /lib/ld-2.2.6.so)
==19608==    by 0x44463E: (within /lib/libc-2.2.6.so)
==19608==    by 0x119A45: _dl_catch_error (in /lib/ld-2.2.6.so)
==19608== 
==19608== 
==19608== 454 bytes in 1 blocks are still reachable in loss record 6 of 6
==19608==    at 0x13503A: calloc (vg_replace_malloc.c:284)
==19608==    by 0x117D62: (within /lib/ld-2.2.6.so)
==19608==    by 0x11407D: (within /lib/ld-2.2.6.so)
==19608==    by 0x11532B: _dl_map_object (in /lib/ld-2.2.6.so)
==19608== 
==19608== LEAK SUMMARY:
==19608==    definitely lost: 16 bytes in 1 blocks.
==19608==    possibly lost:   0 bytes in 0 blocks.
==19608==    still reachable: 656 bytes in 5 blocks.
==19608==         suppressed: 0 bytes in 0 blocks.
8<------------------------------------------------------------------

Как выяснилось в результате некоторого усилия, сходная картина
наблюдается при использовании netcat и telnet.

Это избывается только полным изъятием из кода любой клиентской части,
начиная с connect. В программе, которая в коде несёт только сервер,
такого поведения не демонстрирует.

версия glibc -

[peet@kelisaari peet]$ rpm -qa | grep glibc
glibc-2.2.6-alt0.11
glibc-gconv-modules-2.2.6-alt0.11
glibc-devel-static-2.2.6-alt0.11
glibc-utils-2.2.6-alt0.11
glibc-kernheaders-2.4.21-alt1
glibc-nss-2.2.6-alt0.11
glibc-timezones-2.2.6-alt0.11
glibc-core-2.2.6-alt0.11
glibc-locales-2.2.6-alt0.11
glibc-devel-2.2.6-alt0.11
drweb-4.30-glibc.2.2

На других версиях/дистрибутивах пока не гонял.


Это какая-то известная фича, с которой я просто впервые сталкиваюсь в
результате малого опыта, или таракан в голове, или просто бага такая?

-- 

<signature />


                 reply	other threads:[~2004-02-02 17:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040202204358.458634be.peet@altlinux.ru \
    --to=peet@altlinux.ru \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git