Delete the space of queue and vector after use 09/275109/3 accepted/tizen/unified/20220526.144231 submit/tizen/20220525.001052
authorTaeminYeom <taemin.yeom@samsung.com>
Tue, 17 May 2022 01:17:36 +0000 (10:17 +0900)
committerTaeminYeom <taemin.yeom@samsung.com>
Tue, 17 May 2022 05:37:03 +0000 (14:37 +0900)
Change-Id: I982e9012adaf815c8f081b7f9e8ac2267f79de18
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
src/shared/event_loop.cpp

index 1db808c98eeb8f6ff6100dec7aeaecab3515280c..720687b8c38ab8ab2bb0ee66fe6fb7c5e6d131f6 100644 (file)
@@ -58,7 +58,11 @@ static void release_res()
 
        for (auto &it : channel_handler_release_list)
                delete it;
-       channel_handler_release_list.clear();
+
+       /* To reduce memory allocation, swap to new data structure.
+          This prevents occasional over-allocation of memory. */
+       std::priority_queue<channel*>().swap(channel_release_queue);
+       std::vector<channel_handler*>().swap(channel_handler_release_list);
 }
 
 static gboolean g_io_handler(GIOChannel *ch, GIOCondition condition, gpointer data)