Explorar o código

ProcessManager: Do a little less malloc() in the /proc/memstats parsing.

Andreas Kling %!s(int64=6) %!d(string=hai) anos
pai
achega
67d7fc94fc
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      Applications/ProcessManager/MemoryStatsWidget.cpp

+ 2 - 2
Applications/ProcessManager/MemoryStatsWidget.cpp

@@ -62,7 +62,8 @@ void MemoryStatsWidget::refresh()
         auto line = m_proc_memstat.read_line(BUFSIZ);
         auto line = m_proc_memstat.read_line(BUFSIZ);
         if (line.is_null())
         if (line.is_null())
             break;
             break;
-        auto parts = String::from_byte_buffer(line, Chomp).split(',');
+        auto chomped = String((const char*)line.pointer(), line.size() - 1, Chomp);
+        auto parts = chomped.split_view(',');
         if (parts.size() < 9)
         if (parts.size() < 9)
             break;
             break;
         bool ok;
         bool ok;
@@ -94,7 +95,6 @@ void MemoryStatsWidget::refresh()
         m_user_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(user_pages_alloc), page_count_to_kb(user_pages_available)));
         m_user_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(user_pages_alloc), page_count_to_kb(user_pages_available)));
         m_supervisor_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(supervisor_pages_alloc), page_count_to_kb(supervisor_pages_available)));
         m_supervisor_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(supervisor_pages_alloc), page_count_to_kb(supervisor_pages_available)));
         m_kmalloc_count_label->set_text(String::format("%u/%u (+%u)", kmalloc_call_count, kfree_call_count, kmalloc_call_count - kfree_call_count));
         m_kmalloc_count_label->set_text(String::format("%u/%u (+%u)", kmalloc_call_count, kfree_call_count, kmalloc_call_count - kfree_call_count));
-        break;
     }
     }
 }
 }