diff --git a/main.cpp b/main.cpp index 9905af1..1301471 100644 --- a/main.cpp +++ b/main.cpp @@ -75,7 +75,7 @@ int main(int argc, char **argv) size_t num_of_logs = Bank::NumOfLogs(); size_t num_of_users = Bank::NumOfUsers(); std::cout << "\n\nLoaded " << num_of_users << " Users ~" << (float)(sizeof(User) * num_of_users) / 1048576 << "Mb" - << "\nLoaded " << num_of_logs << " Logs ~" << (float)(num_of_logs * (90 + 80 + (max_name_size * 2))) / 1048576 << "Mb" //90:string representation(heap), sizeof(Transaction), max_name_size*2:filled to&from(heap) + << "\nLoaded " << num_of_logs << " Logs ~" << (float)(num_of_logs * (91 + 80 + (max_name_size * 2))) / 1048576 << "Mb" //91:string representation(heap), sizeof(Transaction), max_name_size*2:filled to&from(heap) << "\nLoaded " << Bank::SumBal() << " CSH" << std::endl; //flushing before EventLoop diff --git a/src/log.cpp b/src/log.cpp index b146e95..e664c7b 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -15,8 +15,7 @@ std::string Log::GetLogs() noexcept if (log_flag.GetChangeState() && data.size()) //if there are changes { //re-generate snapshot - //({\"amount\":1,\"from\":\"\",\"time\":1625943626,\"to\":\"\"}, + (2*max_name_size)+10+10) * # of logs) + 1 - size_t predicted_size = ((60 + (2 * max_name_size)) * data.size()) + 1; + size_t predicted_size = ((59 + (2 * max_name_size)) * data.size()) + 1; if (log_snapshot.capacity() < predicted_size) { log_snapshot.reserve(predicted_size);