I got a doubt with memory allocation in Linux
I am having 256 MB of RAM in my portable player and the linux kernel is given with parameter "MEM=110M" while booting,
Can any one explain what does that mean
Is it a ...
1) 110 M is given for Kernel memory and remaining 146 is for user-space memory
or 2) 110M is given for kernel & user-space and remaining can be configured as per requirement (may be... say, driver memory)
Also, when i start a application that has many malloc in it., at some point the malloc() function returns null., whereas i parallely checking through Telnet for the "free memory space" through "free" cmd, it returns 39 MB as unused (ie., free)
I am little confused now (may be i am not knowing the memory partitions), can any one explain on this
Thanks in advance
Thanks Jlliagre, My free observation is here
" Jlliagre --- Malloc is allocating virtual memory while free is displaying RAM and SWAP usage "
fine, then does it mean that virtual memory for a process is fixed amount so that other processes will also get memory, instead of putting other processes running out of memory.
my concern is even-though free shows 39868 KB, it fails on malloc() of 2.5 MB
My understanding of this option is that 110M are given for kernel & user-space and the remaining 146 are wasted as far a Linux is concerned. The BIOS might use it but it's unlikely to be useful in your case. Normally, that's the other way around. This option was created to allow Linux to use all of your memory if for some reason it wasn't able to detect the whole of it at boot time.
As of malloc and free discrepancies. Malloc is allocating virtual memory while free is displaying RAM and SWAP usage. These are not strictly related, especially when overcommitting is enabled. Add "free" output to you question to clarify.
answered 03 May '10, 10:07
How much storage size does you PMP shows when you connect it to a comp. Does it show 256 - 110 = 146MB ?
answered 03 May '10, 15:48
mem=0 option enables kernel to boot and use all the available memory. In you case all 256 MB. Now 110 M means,remaining 146 M is wasted.
answered 03 May '10, 12:09
Do you use onboard video? Most onboard GPUs like to take system RAM and convert it to VRAM so they can function properly. That could be what's happening there. Might be good to upgrade to an actual video card.
Then again, most integrated GPUs don't take over 25% of system RAM.
I personally am not suffering this problem as I have a PCI-E video card and I don't see my kernel allocating anything less than what my system actually has.
answered 03 May '10, 16:32
Yes; now i got some more information, i could allocate memory without any issues by setting
Further on googling and on some discussion Since Kernel version 2.5.30 the values for
Here /proc/sys/vm/overcommit_ratio (by default 50) is another user-settable parameter.
so out of my 110 MB 50 % is allocatable and remaining are for left "free" for other operations..(i guess for other processes too .. need to experiment on this)
ence by changing this to 80 %; now i am getting successive malloc() operation
(See also Documentation/vm/overcommit-accounting)
answered 05 May '10, 08:48
Here is my Observation
Generated by /proc/meminfo.
answered 06 May '10, 10:34