bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] Readline memory leak


From: Anil Motilal Mahtani Mirchandani
Subject: [Bug-readline] Readline memory leak
Date: Mon, 17 May 2010 11:47:21 +0100

Hello,

I am using libreadline 6.1 and I've found that valgrind reports still reachable memory. It's a very simple piece of code:

#include <stdlib.h>
#include <readline/readline.h>
   

int main()
{
    char *buf;
       
        while((buf = readline("Hello: "))!=NULL) {
                if(strcmp(buf,"exit") == 0){
                    free(buf);
                    break;
                }
                free(buf);
    }


    return 0;
}


And here is the valgrind output:

==9958== Memcheck, a memory error detector
==9958== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==9958== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==9958== Command: ./READY
==9958==
Hellol: exit
==9958==
==9958== HEAP SUMMARY:
==9958==     in use at exit: 42,911 bytes in 154 blocks
==9958==   total heap usage: 285 allocs, 131 frees, 58,543 bytes allocated
==9958==
==9958== LEAK SUMMARY:
==9958==    definitely lost: 0 bytes in 0 blocks
==9958==    indirectly lost: 0 bytes in 0 blocks
==9958==      possibly lost: 0 bytes in 0 blocks
==9958==    still reachable: 42,911 bytes in 154 blocks
==9958==         suppressed: 0 bytes in 0 blocks
==9958== Rerun with --leak-check=full to see details of leaked memory
==9958==
==9958== For counts of detected and suppressed errors, rerun with: -v
==9958== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 8)


I just wanted to know if this is supposed to be this way or if it's some kind of bug.

Thanks in advance.
--
Anil M. Mahtani Mirchandani
address@hidden
http://rincondeanil.wordpress.com/
I.T.Informática de Sistemas



reply via email to

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