Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] Re: (PR#6605) memory leak in server (readline)
Home

[Freeciv-Dev] Re: (PR#6605) memory leak in server (readline)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#6605) memory leak in server (readline)
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Tue, 28 Oct 2003 10:51:54 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, Oct 22, 2003 at 06:21:44AM -0700, Jason Short wrote:
> 
> ==8657== 40 bytes in 2 blocks are definitely lost in loss record 5 of 18
> ==8657==    at 0x40160749: malloc (vg_clientfuncs.c:103)
> ==8657==    by 0x40310A21: xmalloc (in /usr/lib/libreadline.so.4.3)
> ==8657==    by 0x40313EC2: sh_set_lines_and_columns (in 
> /usr/lib/libreadline.so.4.3)
> ==8657==    by 0x4030D3B2: _rl_get_screen_size (in 
> /usr/lib/libreadline.so.4.3)
> ==8657==    by 0x4030D79D: _rl_init_terminal_io (in 
> /usr/lib/libreadline.so.4.3)==8657==    by 0x402FBBEA: 
> readline_initialize_everything (in /usr/lib/libreadline.so.4.3)
> ==8657==    by 0x402FBB54: rl_initialize (in /usr/lib/libreadline.so.4.3)
> ==8657==    by 0x809C540: sniff_packets (sernet.c:357)
> ==8657==    by 0x804FAAC: main_loop (srv_main.c:1480)
> ==8657==    by 0x80503E4: srv_loop (srv_main.c:1812)
> ==8657==    by 0x804FE68: srv_main (srv_main.c:1599)
> ==8657==    by 0x804A27B: main (civserver.c:154)
> ==8657==    by 0x403A04EC: __libc_start_main (in /lib/libc-2.3.2.so)
> ==8657==    by 0x8049C60: (within /tmp/jshort/freeciv/server/civserver)
> 
> Of course this leak only happens once.

IIRC there are other places where we loose one-time memory to 3rd
party libraries.

> It seems this is a bug in readline, or are we missing some
> uninitialize function?

It doesn't look like readline have an uninitialize function.

From 
http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Modules/readline.c?only_with_tag=HEAD&view=markup:

  /* Initialize (allows .inputrc to override)
   *
   * XXX: A bug in the readline-2.2 library causes a memory leak
   * inside this function.  Nothing we can do about it.
   */
  rl_initialize();

This also confirms this.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Any sufficiently advanced technology is indistinguishable from magic."
    -- Arthur C. Clarke



[Prev in Thread] Current Thread [Next in Thread]