Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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
Yes, i confirmed it by experiement; now i increased the MEM=128M and i DIDN'T found the malloc() fail.,
But still i wonder, eventhough the "free" shows 39 MB, why malloc was failed in the case of MEM=110M
The reason may be
1. Does "free" command shows something different or
2. Is the memory is got fragmented and not able to get the memory of my requested size..
1. Does "free" command shows something different or
free generally shows something different from what a beginner would think he understands by looking at its output. But that isn't a factor in this case.
Quote:
2. Is the memory is got fragmented and not able to get the memory of my requested size.
Fragmentation occurs in the virtual space, not physical and on a much bigger system running much bigger problems it could be a reason malloc fails when there is plenty of ram. Not so in this case.
Linux reserves part of the free memory for "more important" uses than ordinary user programs. On a system with very little ram (relative to whatever you're trying to run) more might be reserved that way than is beneficial. I'm not sure what parameters manage that feature.
free generally shows something different from what a beginner would think he understands by looking at its output. But that isn't a factor in this case.
Yes i thought, it shows the HEAP memory. but seems not. then.. how HEAP size alloted ? please explain and why my malloc() fails
Thanks johnsfine
Quote:
Linux reserves part of the free memory for "more important" uses than ordinary user programs. On a system with very little ram (relative to whatever you're trying to run) more might be reserved that way than is beneficial. I'm not sure what parameters manage that feature.
,
Experts, can you please give your comments on this
I would try starting without the "MEM=" parameter in place, because you probably don't need (or want) it at all.
The "boot loader," which loads Linux itself, ought to provide some way for you to override that parameter at startup-time, i.e. "just this once," so that you can see if it works for you.
I once worked with a little box that, for some reason, didn't report the memory-size correctly. This parameter allowed me to impose my knowledge of what the correct value should be.
Yes; now i got some more information, i could allocate memory without any issues by setting
80 on /proc/sys/vm/overcommit_ratio
Further on googling and on some discussion
Since Kernel version 2.5.30 the values for
/proc/sys/vm/overcommit_memory
0 (default): as before: guess about how much overcommitment is reasonable,
1: never refuse any malloc(),
2: be precise about the overcommit - never commit a virtual address space larger than swap space plus a fraction overcommit_ratio of the physical memory.
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)
hence by changing this to 80 %; now i am getting successive malloc() operation
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.