From 0c7571382021992a5571e6370c9e8b87fcec82fe Mon Sep 17 00:00:00 2001 From: gullradriel <3157857+gullradriel@users.noreply.github.com> Date: Thu, 22 Jun 2023 22:26:15 +0200 Subject: [PATCH] using emplace_back instead of push_back * using emplace_back instead of push_back is giving better results in regards of the memory management and crashes * we tried with all our best ideas, we don't know why it's better but it outperformed every other allocations method tested --- firmware/application/freqman.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/application/freqman.cpp b/firmware/application/freqman.cpp index d8325b361..14e664f64 100644 --- a/firmware/application/freqman.cpp +++ b/firmware/application/freqman.cpp @@ -205,7 +205,8 @@ bool load_freqman_file(std::string& file_stem, freqman_db& db, bool load_freqs, description.shrink_to_fit(); } if ((type == SINGLE && load_freqs) || (type == RANGE && load_ranges) || (type == HAMRADIO && load_hamradios)) { - db.push_back({frequency_a, frequency_b, description, type, modulation, bandwidth, step, tone}); + freqman_entry entry = {frequency_a, frequency_b, std::move(description), type, modulation, bandwidth, step, tone}; + db.emplace_back(entry); n++; if (n > max_num_freqs) return true; }