[ 
https://issues.apache.org/jira/browse/HDFS-4467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13649599#comment-13649599
 ] 

Shubhangi Garg commented on HDFS-4467:
--------------------------------------

Hi Suo Tong,

The problem still persists for me, and I get memory leaks using hdfsConnect() 
functions from libhdfs.


                
> Segmentation fault in libhdfs while connecting to HDFS, in an application 
> populating Hive Tables
> ------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-4467
>                 URL: https://issues.apache.org/jira/browse/HDFS-4467
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: libhdfs
>    Affects Versions: 1.0.4
>         Environment: Ubuntu 12.04 (32 bit), application in C++, hadoop 1.0.4
>            Reporter: Shubhangi Garg
>
> Connecting to HDFS using the libhdfs compiled library gives a segmentation 
> vault and memory leaks; easily verifiable by valgrind.
> Even a simple application program given below has memory leaks:
> #include "hdfs.h"
> #include <iostream>
> int main(int argc, char **argv) {
>     hdfsFS fs = hdfsConnect("localhost", 9000);
>     const char* writePath = "/tmp/testfile.txt";
>     hdfsFile writeFile = hdfsOpenFile(fs, writePath, O_WRONLY|O_CREAT, 0, 0, 
> 0);
>     if(!writeFile) {
>           fprintf(stderr, "Failed to open %s for writing!\n", writePath);
>           exit(-1);
>     }
>     char* buffer = "Hello, World!";
>     tSize num_written_bytes = hdfsWrite(fs, writeFile, (void*)buffer, 
> strlen(buffer)+1);
>     if (hdfsFlush(fs, writeFile)) {
>            fprintf(stderr, "Failed to 'flush' %s\n", writePath);
>           exit(-1);
>     }
>    hdfsCloseFile(fs, writeFile);
> }
> shell>valgrind  --leak-check=full ./sample
> ==12773== LEAK SUMMARY:
> ==12773==    definitely lost: 7,893 bytes in 21 blocks
> ==12773==    indirectly lost: 4,460 bytes in 23 blocks
> ==12773==      possibly lost: 119,833 bytes in 121 blocks
> ==12773==    still reachable: 1,349,514 bytes in 8,953 blocks

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to