Git Product home page Git Product logo

Comments (3)

zkamvar avatar zkamvar commented on June 13, 2024

If you're interested, here's what went on when I was attempting to find a memory leak in my own code: grunwaldlab/poppr#40

I also have a build of R-devel with valgrind enabled: https://github.com/grunwaldlab/poppr/wiki/R-CMD-check-with-docker-rocker

My experience installing R with valgrind has been frustrating, even on Ubuntu. Docker can still be frustrating, but it's not as frustrating as trying to compile R from source.

from vcfr.

zkamvar avatar zkamvar commented on June 13, 2024

Valgrind reports:

vcf functions: ......................==18546== Conditional jump or move depends on uninitialised value(s)
==18546==    at 0x30750046DC: deflate (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x307500DDFC: ??? (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x307500E685: gzclose_w (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x1139582A: write_vcf_body(Rcpp::Matrix<16, Rcpp::PreserveStorage>, Rcpp::Matrix<16, Rcpp::PreserveStorage>, std::string, int) (packages/tests-vg/vcfR/src/vcf_io.cpp:555)
==18546==    by 0x11374EB8: vcfR_write_vcf_body (packages/tests-vg/vcfR/src/RcppExports.cpp:263)
==18546==    by 0x47AFAD: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==18546==    by 0x4B1039: Rf_eval (svn/R-devel/src/main/eval.c:713)
==18546==    by 0x4B446D: do_set (svn/R-devel/src/main/eval.c:2211)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B3418: do_begin (svn/R-devel/src/main/eval.c:1821)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==  Uninitialised value was created by a heap allocation
==18546==    at 0x4A06C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18546==    by 0x307500CA69: ??? (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x113952B9: write_vcf_body(Rcpp::Matrix<16, Rcpp::PreserveStorage>, Rcpp::Matrix<16, Rcpp::PreserveStorage>, std::string, int) (packages/tests-vg/vcfR/src/vcf_io.cpp:520)
==18546==    by 0x11374EB8: vcfR_write_vcf_body (packages/tests-vg/vcfR/src/RcppExports.cpp:263)
==18546==    by 0x47AFAD: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==18546==    by 0x4B1039: Rf_eval (svn/R-devel/src/main/eval.c:713)
==18546==    by 0x4B446D: do_set (svn/R-devel/src/main/eval.c:2211)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B3418: do_begin (svn/R-devel/src/main/eval.c:1821)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B3418: do_begin (svn/R-devel/src/main/eval.c:1821)
==18546== 
==18546== Conditional jump or move depends on uninitialised value(s)
==18546==    at 0x30750046DC: deflate (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x307500DE56: ??? (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x307500E685: gzclose_w (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x1139582A: write_vcf_body(Rcpp::Matrix<16, Rcpp::PreserveStorage>, Rcpp::Matrix<16, Rcpp::PreserveStorage>, std::string, int) (packages/tests-vg/vcfR/src/vcf_io.cpp:555)
==18546==    by 0x11374EB8: vcfR_write_vcf_body (packages/tests-vg/vcfR/src/RcppExports.cpp:263)
==18546==    by 0x47AFAD: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==18546==    by 0x4B1039: Rf_eval (svn/R-devel/src/main/eval.c:713)
==18546==    by 0x4B446D: do_set (svn/R-devel/src/main/eval.c:2211)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B3418: do_begin (svn/R-devel/src/main/eval.c:1821)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==  Uninitialised value was created by a heap allocation
==18546==    at 0x4A06C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18546==    by 0x307500CA69: ??? (in /usr/lib64/libz.so.1.2.8)
==18546==    by 0x113952B9: write_vcf_body(Rcpp::Matrix<16, Rcpp::PreserveStorage>, Rcpp::Matrix<16, Rcpp::PreserveStorage>, std::string, int) (packages/tests-vg/vcfR/src/vcf_io.cpp:520)
==18546==    by 0x11374EB8: vcfR_write_vcf_body (packages/tests-vg/vcfR/src/RcppExports.cpp:263)
==18546==    by 0x47AFAD: do_dotcall (svn/R-devel/src/main/dotcode.c:1252)
==18546==    by 0x4B1039: Rf_eval (svn/R-devel/src/main/eval.c:713)
==18546==    by 0x4B446D: do_set (svn/R-devel/src/main/eval.c:2211)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B3418: do_begin (svn/R-devel/src/main/eval.c:1821)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B0E90: Rf_eval (svn/R-devel/src/main/eval.c:685)
==18546==    by 0x4B3418: do_begin (svn/R-devel/src/main/eval.c:1821)
==18546== 

When you look at lines 520 and 555 in the code, you see a gzFile being created. I notice that there's another gzFile opened here: https://github.com/knausb/vcfR/blob/v1.2.0/src/vcf_io.cpp#L47, but it's being initialized before gzopen is being called.

I wonder if this could be fixed by separating the declaration from the function:

gzFile fi;
fi = gzopen( filename.c_str(), "ab" );

from vcfr.

knausb avatar knausb commented on June 13, 2024

I think I addressed this a while ago. Thanks @zkamvar for your help and ideas! I'm slowly becoming better with Docker.

from vcfr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.