Binary files /tmp/tmpju6my4ri/D9SvLNqNkk/prinbee-1.0.0.3~mantic/debian/.changelog.swp and /tmp/tmpju6my4ri/SSjyIRrKqZ/prinbee-1.0.0.4~mantic/debian/.changelog.swp differ diff -Nru prinbee-1.0.0.3~mantic/debian/changelog prinbee-1.0.0.4~mantic/debian/changelog --- prinbee-1.0.0.3~mantic/debian/changelog 2023-12-25 02:01:20.000000000 +0000 +++ prinbee-1.0.0.4~mantic/debian/changelog 2023-12-25 17:06:59.000000000 +0000 @@ -1,4 +1,10 @@ -prinbee (1.0.0.3~mantic) mantic; urgency=high +prinbee (1.0.0.4~mantic) mantic; urgency=high + + * Fixed a memory leak with files being kept in two locations. + + -- Alexis Wilke Mon, 25 Dec 2023 09:06:59 -0800 + +prinbee (1.0.0.3~bionic) bionic; urgency=high * Added more test and a better journalling. Binary files /tmp/tmpju6my4ri/D9SvLNqNkk/prinbee-1.0.0.3~mantic/prinbee/journal/.journal.cpp.swp and /tmp/tmpju6my4ri/SSjyIRrKqZ/prinbee-1.0.0.4~mantic/prinbee/journal/.journal.cpp.swp differ diff -Nru prinbee-1.0.0.3~mantic/prinbee/journal/journal.cpp prinbee-1.0.0.4~mantic/prinbee/journal/journal.cpp --- prinbee-1.0.0.3~mantic/prinbee/journal/journal.cpp 2023-12-25 01:14:13.000000000 +0000 +++ prinbee-1.0.0.4~mantic/prinbee/journal/journal.cpp 2023-12-25 05:05:04.000000000 +0000 @@ -435,12 +435,34 @@ if(size == sizeof(event_journal_header_t) && file_management == file_management_t::FILE_MANAGEMENT_DELETE) { - ::unlink(f_filename.c_str()); + int const r(::unlink(f_filename.c_str())); + if(r != 0) + { + int const e(errno); + SNAP_LOG_ERROR + << "unlink() generated an error (" + << e + << ", " + << strerror(e) + << ")." + << SNAP_LOG_SEND; + } f_next_append = 0; } else { - ::ftruncate(fd, size); + int const r(::ftruncate(fd, size)); + if(r != 0) + { + int const e(errno); + SNAP_LOG_ERROR + << "ftruncate() generated an error (" + << e + << ", " + << strerror(e) + << ")." + << SNAP_LOG_SEND; + } } // those should not be necessary, but I think it makes sense to @@ -911,7 +933,7 @@ return true; } - // too large, try the next file + // event too large for this file, try the next file // ++f_current_file_index; if(f_current_file_index >= f_maximum_number_of_files) @@ -1510,12 +1532,12 @@ << std::to_string(static_cast(index)) << " > " << f_maximum_number_of_files - << '.'; + << ")."; SNAP_LOG_ERROR << ss.str() << SNAP_LOG_SEND; throw invalid_parameter(ss.str()); } - file::pointer_t f(f_event_files[index]); + file::pointer_t f(f_event_files[index].lock()); if(f != nullptr) { return f; @@ -1665,7 +1687,7 @@ // . shrink (truncate) // . be deleted (delete) // - it->second->get_file()->set_next_append(sizeof(event_journal_header_t)); + f->set_next_append(sizeof(event_journal_header_t)); } break; diff -Nru prinbee-1.0.0.3~mantic/prinbee/journal/journal.h prinbee-1.0.0.4~mantic/prinbee/journal/journal.h --- prinbee-1.0.0.3~mantic/prinbee/journal/journal.h 2023-12-25 00:53:45.000000000 +0000 +++ prinbee-1.0.0.4~mantic/prinbee/journal/journal.h 2023-12-25 04:23:15.000000000 +0000 @@ -244,7 +244,8 @@ public: typedef std::shared_ptr pointer_t; - typedef std::vector + typedef std::weak_ptr weak_pointer_t; + typedef std::vector vector_t; file( @@ -281,7 +282,6 @@ journal * f_journal = nullptr; std::shared_ptr f_event_file = std::shared_ptr(); - //location::location_map_t f_locations = location::location_map_t(); std::ios::pos_type f_pos_read = 0; std::ios::pos_type f_pos_write = 0; std::uint32_t f_event_count = 0; diff -Nru prinbee-1.0.0.3~mantic/seed.txt prinbee-1.0.0.4~mantic/seed.txt --- prinbee-1.0.0.3~mantic/seed.txt 2023-12-25 01:57:28.000000000 +0000 +++ prinbee-1.0.0.4~mantic/seed.txt 2023-12-25 16:02:08.000000000 +0000 @@ -1 +1 @@ -1703469448 +1703520128