Как Linux вычисляет MemFree

SGLIB является превосходной универсальной библиотекой структур данных. Библиотека в настоящее время обеспечивает универсальные реализации для:
массивы сортировки
связанные списки
отсортированные связанные списки
двойные связанные списки
красно-черные деревья
хешированные контейнеры

Это очень быстро, быстрее, чем бойкий. Это вдохновлено Стандартной библиотекой шаблонов. Загрузка Здесь

Другое решение программное обеспечение Attractive Chaos . C библиотека макросов:
kbtree.h: эффективная библиотека B-дерева в C.
khash.h: быстро и взвешенная светом библиотека хэш-таблицы в C.
kvec.h: контейнер простого вектора в C.

программное обеспечение Sglib и Attractive Chaos библиотека макросов C. Используя пустоту* для реализации универсальных контейнеров в C может быть неэффективным. C макросы подражает шаблону C++ и так же эффективны как шаблон C++

9
задан simon 10 September 2009 в 20:48
поделиться

2 ответа

MemFree in /proc/meminfo is a count of how many pages are free in the buddy allocator. This buddy allocator is the fundamental unit of physical memory allocation in the kernel; however there are a lot of ways pages can be returned to the buddy allocator in time of need - for example, freeing empty SLABs, discarding cache/buffer RAM (even if this means invalidating PTEs in a running process), or as a last resort, swapping things out.

In fact, MemFree is generally controlled to be only 5-10% of total physical RAM, with any extra free RAM being co-opted into cache as time goes on. As such, MemFree alone is a very incomplete view of the overall memory situation.

As for the virtual memory (VSIZE) of a given process, this refers to the sum total of the sizes of all mapped memory segments in the process's address space. However, not all of these will be physically present - some may be paged in upon first access and as such will not register as memory in use until actually used. The resident size (RSIZE) is a more accurate view, as it only registers pages that are mapped in right now - although this may also not be accurate if a given page is mapped in multiple virtual addresses (which is very common when you consider multiple processes - shared libraries have the same physical RAM mapped to all processes that are using that library)

13
ответ дан 4 December 2019 в 13:03
поделиться

Try using htop. You will have to install it sudo apt-get install htop or yum install htop, whatever.

It will show you a more accurate representation of memory usage.

Basically, it comes down to "buffers/cache".

free -m

Look at the free column in the buffers/cache row, this is a more accurate representation of what is actually available.

             total       used       free     shared    buffers     cached
Mem:          3770       3586        183          0        112       1498
-/+ buffers/cache:       1976       1793
Swap:         7624        750       6874
3
ответ дан 4 December 2019 в 13:03
поделиться
Другие вопросы по тегам:

Похожие вопросы: