Silo icon indicating copy to clipboard operation
Silo copied to clipboard

udata being leaked after DBClose

Open aowen87 opened this issue 6 years ago • 0 comments

Recently, I got complaints that there were massive memory leaks in my implementation of load balancing (a pretty understandable complaint), so I am now going back to fix things. I got most of them, but there is one small memory leak in silo that I am not sure about. In valgrind, we see that the memory leak occurs in silo_hdf5.c 4927, in the function db_hdf5_process_file_options. The line is: if (NULL == (udata = (db_hdf5_H5LT_file_image_ud_t *)malloc(sizeof(db_hdf5_H5LT_file_image_ud_t)))). In my ALE3D code, I have astd::vector which contains some bytes ( an in-memory hdf5 file ) that were sent from one processor to another. I am taking those bytes and making them into a silo file again as follows: int file_len = (int)fileBytes.size(); char **fileBytesChar = (char )malloc(file_len); std::copy(fileBytes.begin(), fileBytes.end(), fileBytesChar); int fic_vfd = DB_H5VFD_FIC; DBAddOption(core_opts, DBOPT_H5_VFD, &fic_vfd); DBAddOption(core_opts, DBOPT_H5_FIC_SIZE, &file_len); DBAddOption(core_opts, DBOPT_H5_FIC_BUF, fileBytesChar); core_opts_id = DBRegisterFileOptionsSet(core_opts); / Ok, now have Silo open this buffer **/ retval = DBOpen(name, DB_HDF5_OPTS(core_opts_id), DB_READ); // MEMORY BUG WHEN THIS IS CALLED, IN db_hdf5_process_file_options . if (retval == nullptr) { Fail("MakeVirDB", "Failure to make virtual file from vector of bytes") ; }

-----------------------REDMINE MIGRATION----------------------- This ticket was migrated from Redmine. As such, not all information was able to be captured in the transition. Below is a complete record of the original redmine ticket.

Ticket number: 2872 Status: New Project: VisIt Tracker: Bug Priority: Normal Subject: udata being leaked after DBClose Assigned to: - Category: - Target version: - Author: Mark Miller Start: 07/26/2017 Due date: % Done: 0% Estimated time: Created: 07/26/2017 07:18 pm Updated: 07/26/2017 07:19 pm Likelihood: 3 - Occasional Severity: 2 - Minor Irritation Found in version: 4.8 Impact: Expected Use: OS: All Support Group: Any Description: Recently, I got complaints that there were massive memory leaks in my implementation of load balancing (a pretty understandable complaint), so I am now going back to fix things. I got most of them, but there is one small memory leak in silo that I am not sure about. In valgrind, we see that the memory leak occurs in silo_hdf5.c 4927, in the function db_hdf5_process_file_options. The line is: if (NULL == (udata = (db_hdf5_H5LT_file_image_ud_t *)malloc(sizeof(db_hdf5_H5LT_file_image_ud_t)))). In my ALE3D code, I have astd::vector which contains some bytes ( an in-memory hdf5 file ) that were sent from one processor to another. I am taking those bytes and making them into a silo file again as follows: int file_len = (int)fileBytes.size(); char **fileBytesChar = (char )malloc(file_len); std::copy(fileBytes.begin(), fileBytes.end(), fileBytesChar); int fic_vfd = DB_H5VFD_FIC; DBAddOption(core_opts, DBOPT_H5_VFD, &fic_vfd); DBAddOption(core_opts, DBOPT_H5_FIC_SIZE, &file_len); DBAddOption(core_opts, DBOPT_H5_FIC_BUF, fileBytesChar); core_opts_id = DBRegisterFileOptionsSet(core_opts); / Ok, now have Silo open this buffer **/ retval = DBOpen(name, DB_HDF5_OPTS(core_opts_id), DB_READ); // MEMORY BUG WHEN THIS IS CALLED, IN db_hdf5_process_file_options . if (retval == nullptr) { Fail("MakeVirDB", "Failure to make virtual file from vector of bytes") ; }

Comments:

aowen87 avatar Feb 27 '19 01:02 aowen87