реклама на сайте
подробности

 
 
> проблема с функцией malloc и памятью, linux 2.6.17
andron86
сообщение Jun 11 2008, 11:29
Сообщение #1


Местный
***

Группа: Участник
Сообщений: 406
Регистрация: 1-03-06
Пользователь №: 14 821



Кто-нибудь сталкивался с такой проблемой? В общем имею embedded linux 2.6.17 на арме(pxa255). При выделении динамической памяти функцией malloc системная память не уменьшается, то есть при вызове например free свободного пространства остается столько же сколько и до выделения. Но при выделении памяти и заполнением, к примеру дамми байтами, фрее показывает правильно. Это нормально, или глюк? Если нормально то скиньте пожалуйста ссылочку где это описано, а то заказчики достали sad.gif .
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
Harbour
сообщение Jun 12 2008, 04:52
Сообщение #2


Местами Гуру
*****

Группа: Validating
Сообщений: 1 103
Регистрация: 5-12-04
Пользователь №: 1 323



/proc/sys/vm/overcommit_memory

linux/Documentation/sysctl/vm.txt:

......
overcommit_memory:

This value contains a flag that enables memory overcommitment.

When this flag is 0, the kernel attempts to estimate the amount
of free memory left when userspace requests more memory.

When this flag is 1, the kernel pretends there is always enough
memory until it actually runs out.

When this flag is 2, the kernel uses a "never overcommit"
policy that attempts to prevent any overcommit of memory.

This feature can be very useful because there are a lot of
programs that malloc() huge amounts of memory "just-in-case"
and don't use much of it.

The default value is 0.

See Documentation/vm/overcommit-accounting and
security/commoncap.c::cap_vm_enough_memory() for more information.
........
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 20th August 2025 - 06:54
Рейтинг@Mail.ru


Страница сгенерированна за 0.01357 секунд с 7
ELECTRONIX ©2004-2016