Search Results

Search found 2 results on 1 pages for 'ela782'.

Page 1/1 | 1 

  • Why does this code leak? (simple codesnippet)

    - by Ela782
    Visual Studio shows me several leaks (a few hundred lines), in total more than a few MB. I traced it down to the following "helloWorld example". The leak disappears if I comment out the H5::DataSet.getSpace() line. #include "stdafx.h" #include <iostream> #include "cpp/H5Cpp.h" int main(int argc, char *argv[]) { _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump leaks at return H5::H5File myfile; try { myfile = H5::H5File("C:\\Users\\yyy\\myfile.h5", H5F_ACC_RDONLY); } catch (H5::Exception& e) { std::string msg( std::string( "Could not open HDF5 file.\n" ) + e.getCDetailMsg() ); throw msg; } H5::Group myGroup = myfile.openGroup("/so/me/group"); H5::DataSet myDS = myGroup.openDataSet("./myfloatvec"); hsize_t dims[1]; //myDS.getSpace().getSimpleExtentDims(dims, NULL); // <-- here's the leak H5::DataSpace dsp = myDS.getSpace(); // The H5::DataSpace seems to leak dsp.getSimpleExtentDims(dims, NULL); //dsp.close(); // <-- doesn't help either std::cout << "Dims: " << dims[0] << std::endl; // <-- Works as expected return 0; } Any help would be appreciated. I've been on this for hours, I hate unclean code...

    Read the article

  • Nested for_each with lambda not possible?

    - by Ela782
    The following code does not compile in VS2012, it gives error C2064: term does not evaluate to a function taking 1 arguments on the line of the second for_each (line 4 below). vector<string> v1; for_each(begin(v1), end(v1), [](string s1) { vector<string> v2; for_each(begin(v2), end(v2), [](string s2) { cout << "..."; }); }); I found some related stuff like http://connect.microsoft.com/VisualStudio/feedback/details/560907/capturing-variables-in-nested-lambdas which shows a bug (they are doing something different) but on the other hand that shows that what I print above should be possible. What's wrong with the above code?

    Read the article

1