Programming :: Total Amount Of Allocated SHM Memory?
Aug 25, 2010Is there an easy way in C to get the total amount of allocated SHM memory on a machine?
View 7 RepliesIs there an easy way in C to get the total amount of allocated SHM memory on a machine?
View 7 RepliesI am trying to write a script to calculate the total amount of installed memory to use during an anaconda kickscript, so the swap file is created at 2 x the installed memory. I so far have the amount of installed RAM DIMMS but need a way to total them up and produce a varible I can use in the pre section of the install.
Code:
dmidecode -t 17 | grep Size | awk ' { print $2 }'
Output:
2048
2048
Note: on some servers there could be from 1 DIMM up to 16 DIMMS installed so the script needs to be able to handle this. I also can not use bc as it does not exist during the install stage. I am guessing I need a while loop to do this and use expr but do not know where to start for this logic.
I am trying to understand a large amount of allocated memory that seems not to be accounted for on my system.I'll say up front that I am discussing memory usage without cache and buffers, 'cause I know that misunderstanding comes up a lot.I am in a KDE 4.3 desktop (Kubuntu 9.10), using a number of java apps like Eclipse that tend to eat up a lot of memory.after a few days, even if I quit most apps, 1 gb of ram remains allocated (out of 2 gb).this appeared excessive, and I took the time to add up all values of the RES column in htop (for all users).the result was about 1/2 gb.am I trying to match the wrong values?or could some memory be allocated and not show up in the process list?this is the output of free
Code:
total used free shared buffers cached
Mem: 2055456 1940264 115192 0 123864 702900
[code]...
I want to calculate the total amount of memory used by the system, Someone please confirm if the below formula is correct.Quote:
((memUsed-mebBuffers-memCached)*100)/memUsed => totalMemoryUsed%
Code:
free -o
total used free shared buffers cached
Mem: 8167004 8115292 51712 0 87680 1444676
Swap: 8388584 3252996 5135588
((8115292-87680-1444676)*100/8115292) => 81%
As per the above calculation 81% of memory is used.Is this correct? and if so Am I running out of memory?what is the limit in % that I should maintain for a better performance?
How do I write a script for my Linux that can show me total memory vs used memory and have it email me results if it's over 70 percent?
View 2 Replies View RelatedI have problem with free allocated file descriptors it's always zero!
View 2 Replies View RelatedI need to allocate a % of the total system memory for a buffer but what is the best method to determine how much memory is in the system? So far the only way I have found is to get the pages of memory:
Code:
long sysconf(_SC_PHYS_PAGES)
Is that the only option?
I would like to know if there is a linux command to verify the amount of memory used by a program. The programs I am using were compiled with gfortran.
View 2 Replies View RelatedI am still confused about the memory issues. i have allocated JAVA_OPTS='-Djava.awt.headless=true -Xms512M -Xmx512M -XX:MaxPermSize=512M' think that it means that i have allocate java to use only 512mb of my memory. but when i run top here is my output.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15932 root 23 0 1495m 1.2g 3732 S 12.0 36.0 121:52.98 java
5070 postgres 15 0 55392 39m 35m R 11.6 1.2 0:51.61 postmaster
[code]....
I want to know if i can increase the memory space allocated for a process manually while the process is running ,,,, and if it is possible how i can do this .
View 2 Replies View RelatedLet's analyse this While registering a Char deriver to kernel think that we had allocated memory using any of malloc/kmalloc/vmalloc.
If we forgot to Free that allocated memory while unregistering, will that memory be allocated aside or kernel clears it...?
OS: RHEL AS 5 64-bit
HDD:300 GB Hardware mirror (HP blade bl460c)
While installing OS, in partition window after OS file system structure I've left 277 GB. But after installation it shows Size - 255GB and available disk space is 242 GB.
Isn't it weired? How can I use the total amount of space in Linux? I need the whole 277GB exactly. What should be my workaround?
On a new box with Debian Lenny, I have 2x2 gig of ddr2 but the karamba applet show only 3291mb. And dmesg show this:
Code:
dmesg | grep Memory
[0.004000] Memory: 3362976k/4194304k available (1769k kernel code, 43092k reserved, 752k data, 244k init, 2489792k highmem)
I am analyzing memory usage on a Linux system. When I run vmstat -s, I see the following:
waffleman@waffle-iron:~$ vmstat -s
3549184 K total memory
3206708 K used memory
1918012 K active memory
1037320 K inactive memory
342476 K free memory
[Code]...
I know the system has 4096 MB of RAM installed, but why does it show only 3466 MB? Can this be interpreted as total "available" memory? Perhaps the missing 630 MB is being used by the kernel and cannot paged out?
I also tried this on on an Embedded Linux system and saw a similar result. The DRAM chip has 128 MB, but only 124 MB shows up in vmstat.
i got a RHEL 5.2 machine.and i noticed that the total used memory(as shown in "free" command) is 3GB higher thanthe sum of RSS size of all processes(collected using "ps aux").i know that its not suppose to be exact because RSS counts ultiple times shared memory (so actually it suppose to be higher than the used memory).the server runs apache which runs a pretty heavy php program.my suspicion is that its memory leak?
View 14 Replies View RelatedI'm running 13.1 on a Dell Latitude D630 with 4GB of RAM. My problem is that Slackware doesn't seem to see all of the available memory. Here are the #s being reported (just including pertinent #s rather than all output)...
Code:
free -m
total: 3546
[code]...
as you should see, top is indicating 3.544.864kb (3.5Gb) of memory used while gnome system monitor only 609Mb. What's wrong here? (I am pretty sure Gnome SM is right. Top is updating every sec.)
View 1 Replies View Relatedis there a way to calculate the total memory consumed by user ?
View 12 Replies View RelatedI have rhgel5.3 installed on IBM blade server having 16 GB of physical memory. But it showing only 4GB.
#cat /proc/meminfo
#free -m
#top
[code]...
I wrote a program that multiplies 2 matrices using multi-threads and another one using multiple processes and shared memory. Both in C.I need to find the total memory usage of these programs. I know of the top command, but when my matrices are relatively small they don't even show up on top because they complete so fast, how can I find the memory usage for these instances?Also, how can I find the total turnaround time of my programs?
View 3 Replies View RelatedTop only show the memory usage for individual processes. Apache often runs hundreds of processes, each of which may use only a small amount of memory, however the total memory consumed by all apache processes can be fairly large.Is there a way to see the total memory usage for all apache processes?
View 7 Replies View RelatedWhen I run ardour sound editing I get this message , but it starts ok Your system has a limit for maximum amount of locked memory! This might cause Ardour to run out of memory before your system runs out of memory. You can view the memory limit with 'ulimit -l', and it is normally controlled by /etc/security/limits.conf
bash-4.1$ ulimit -l
64
my limits.conf is like this
audio - rtprio 99
@audio - memlock 250000
[Code]...
My problem is I installed Zone Minder for camera security and I'm testing it on my laptop with the built in webcam and everything seems to work perfectly except when I try to view the live feed from the camera, it's just a black box. No video.
I checked this website and it's exactly the problem I'm having with a fix for it but his fix doesn't work. He says to type:
Code:
user@ubuntu:~$ sudo echo "256000000" > /proc/sys/kernel/shmmax
user@ubuntu:~$ sudo service apache2 restart
user@ubuntu:~$ sudo service zoneminder restart
But when I do the first line, I get this:
Code:
deemar@Clementine:~$ sudo echo "256000000" > /proc/sys/kernel/shmmax
bash: /proc/sys/kernel/shmmax: Permission denied
I know that seems to be a common question, but information from the web does not So problem is in the title.
Here is what I do:
First I declare the pointers.
Code:
double **rijx,**rijy,**rijz;
Then I allocate the require memory.
[Code]...
I (my friend) have a fortran program with the code along the following lines:
Code:
SUBROUTINE NY
REAL, DIMENSION(4000,4000) :: a, b, c
...
RETURN
END SUBROUTINE PARAMETERS
The problem is that the huge matrices are retained in memory even after the subroutine ends. Is there an easy way to declare the arrays in a sort of dynamic way, like they were in the following C example?
Code:
void ny(void) {
double a[4000,4000];
...
}
I mean in the C example the memory is released as soon ny() exits.
I am looking for an easy way to convert any given maze.txt of any size to a internal array of strings(dynamically allocated). Important is that dimensions of the maze (row, col) shouldn't be written by the user instead they have to be somehow read from the file. This is not my homework assignment! It is a small part of a project that i never dealt with. I never read files to C string.... I made it for specific maze dimensions, but want it to work with any given .txt file.
View 9 Replies View RelatedHere is the issue. I am reading in a outside text file and putting in the string on that line into a char array that is already allocated.
Code:
int main(int argc, char *argv[])
{
[code]....
I have a few multi-user servers in an academic laboratory. I am having a problem with some users maxing out the available RAM, causing such sever slowdowns the machine essentially crashes. My servers are Dell Power Edge's running Ubuntu 8.10 Server Edition (Not my choice). I would like to set a maximum limit on the amount of ram a user can utilize. This morning I experimented with setting limits via /etc/security/limits.conf and using ulimit. Neither of them prevented my test program, a simple infinite loop of mallocs, from crashing the server.
View 7 Replies View RelatedFresh install of Debian 6.0 (squeeze) and the memory shows 3.8 GB. I have 6 sticks of 2 gb on the board.
Pertinent dmesg lines: AMI BIOS detected: BIOS may corrupt low RAM, working around it.
3083MB HIGHMEM available.
883MB LOWMEM available.
Bios tests 12 gb of ram fine.
How to get output of text file containing account number, debit amount, credit amount,date using shell script?
View 1 Replies View Related