[PPL-devel] [Fwd: Re: Is there a way to make SWI-Prolog Valgrind-clean?]

Roberto Bagnara bagnara at cs.unipr.it
Fri Oct 17 09:45:38 CEST 2008



-------- Original Message --------
Subject: Re:  Is there a way to make SWI-Prolog Valgrind-clean?
Date: Fri, 17 Oct 2008 09:10:26 +0200
From: Jan Wielemaker <J.Wielemaker at uva.nl>
To: Roberto Bagnara <bagnara at cs.unipr.it>
CC: swi-prolog at iai.uni-bonn.de
References: <48F7626A.90909 at cs.unipr.it>

On Thursday 16 October 2008 17:48:58 you wrote:
> Dear Jan,
>
> did you receive this message I sent to the mailing list one week ago?
> Thanks,

Yes I did. Maybe I just answered in my mind ... Anyway, basically the
answer is `no'. In theory that is the work of PL_cleanup(), but the
implementation isn't very up-to-date and I have no short-term plan to
fix that. Of course, if someone else does I'm happy to include the
patches.

AFAIK there are no leaks except for one-time initializations that are
not reclaimed.

	Cheers --- Jan

>      Roberto
>
>
> -------- Original Message --------
> Subject: Is there a way to make SWI-Prolog Valgrind-clean?
> Date: Thu, 09 Oct 2008 08:34:28 +0200
> From: Roberto Bagnara <bagnara at cs.unipr.it>
> Organization: Department of Mathematics, University of Parma, Italy
> To: swi-prolog at iai.uni-bonn.de
> CC: The Parma Polyhedra Library developers' list <ppl-devel at cs.unipr.it>
>
>
> Here is what I observe (note that I simply typed Control-D at the prompt):
>
> $ export VALGRIND=yes
> $ valgrind --tool=memcheck -q --trace-children=yes --leak-check=yes
> --num-callers=100 --leak-resolution=high
> --suppressions=/home/roberto/ppl/ppl/tests/valgrind_suppressions
> /usr/local/bin/pl Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version
> 5.6.61)
> Copyright (c) 1990-2008 University of Amsterdam.
> SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
> and you are welcome to redistribute it under certain conditions.
> Please visit http://www.swi-prolog.org for details.
>
> For help, use ?- help(Topic). or ?- apropos(Word).
>
> ?-
> % halt
> ==6515==
> ==6515== 24 bytes in 1 blocks are definitely lost in loss record 16 of 61
> ==6515==    at 0x40054E5: malloc (vg_replace_malloc.c:149)
> ==6515==    by 0x806904F: SinitStreams (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x80E6B69:
> PL_initialise (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==   
> by 0x8050D91: main (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==
> ==6515==
> ==6515== 24 bytes in 1 blocks are definitely lost in loss record 17 of 61
> ==6515==    at 0x40054E5: malloc (vg_replace_malloc.c:149)
> ==6515==    by 0x806901D: SinitStreams (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x80E6B69:
> PL_initialise (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==   
> by 0x8050D91: main (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==
> ==6515==
> ==6515== 24 bytes in 1 blocks are definitely lost in loss record 18 of 61
> ==6515==    at 0x40054E5: malloc (vg_replace_malloc.c:149)
> ==6515==    by 0x8068FE3: SinitStreams (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x80E6B69:
> PL_initialise (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==   
> by 0x8050D91: main (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==
> ==6515==
> ==6515== 1,024 bytes in 1 blocks are definitely lost in loss record 49 of
> 61 ==6515==    at 0x40054E5: malloc (vg_replace_malloc.c:149)
> ==6515==    by 0x805546F: PL_malloc (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x8057A4B:
> codeToAtom (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by
> 0x80B8DD2: simple_term (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl)
> ==6515==    by 0x80B71AA: complex_term (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x80BB6A7:
> read_term (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by
> 0x80BC8AF: read_clause (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl)
> ==6515==    by 0x80BCAEA: pl_read_clause_va (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x8064063:
> PL_next_solution (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==  
>  by 0x80AA604: callProlog (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl)
> ==6515==    by 0x80DA15B: pl_with_mutex (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x805A9F1:
> callForeign (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by
> 0x8061D6C: PL_next_solution (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl)
> ==6515==    by 0x80AA233: prologToplevel (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x80E705F:
> PL_initialise (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==   
> by 0x8050D91: main (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==
> ==6515==
> ==6515== 2,596 (44 direct, 2,552 indirect) bytes in 1 blocks are definitely
> lost in loss record 54 of 61 ==6515==    at 0x40054E5: malloc
> (vg_replace_malloc.c:149)
> ==6515==    by 0x805546F: PL_malloc (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x80D8546:
> allocSimpleMutex (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==  
>  by 0x8098B66: _lookupModule (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x80991A8:
> lookupModule (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by
> 0x8055736: PL_predicate (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl)
> ==6515==    by 0x80E5702: PL_cleanup (in
> /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by 0x8054A41:
> PL_halt (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) ==6515==    by
> 0x8050DB6: main (in /usr/local/lib/pl-5.6.61/bin/i686-linux/pl) $
>
> Is there a way to configure/compile/execute SWI-Prolog so that it
> deallocates all memory before exiting?
> All the best,
>
>     Roberto
>
> --
> Prof. Roberto Bagnara
> Computer Science Group
> Department of Mathematics, University of Parma, Italy
> http://www.cs.unipr.it/~bagnara/
> mailto:bagnara at cs.unipr.it



-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list