LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Closed Thread
 
LinkBack Search this Thread
Old 05-08-2006, 11:31 AM   #1
shashwat.gupta
LQ Newbie
 
Registered: May 2006
Posts: 18

Rep: Reputation: 0
Problem in allocating shared memory size more then 672


Hi there,

I am using Redhat Enterprise Linux 3. I am using it on 512 MB RAM . For some application I want shared memory up to 2.5 GB. I was just trying to get shared memory through simple program that uses shmget system call. for memory allocation. I changed the entry of shmmax with command echo "1073741824" >/proc/sys/kernel/shmmax

Then try to execute a program which allocate shared memory
sharedmemory.c as follows --
#include <sys/types.h>
#include <sys/ipc.h>

#include <sys/shm.h>
#include <errno.h>
#include <stdio.h>


#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>

int main(){


key_t key = 1311;

int m_shmid = shmget(key,1048576*1024,IPC_CREAT|0666);
/*trying to allocate memory size of 1GB */
printf("m_shmid value is %d", m_shmid);
}


/*some header file are extra pleasse do not mind*/

The shmid value comes out to be -1 surprisingly method works perfectly when I try to allocate the memory up to 688128*1024 bytes (That is 672 MB) I donot reason please tell me any thing I need to do make it work

I am executing all commands on root permission
 
Old 05-08-2006, 12:15 PM   #2
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,822

Rep: Reputation: 120Reputation: 120
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

Continue discussion here:
http://www.linuxquestions.org/questi...d.php?t=442816
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ared meprobelm im getting shared memory higher then 672 MB shashwat.gupta Linux - Software 1 05-08-2006 01:03 PM
Allocating Memory in the kernel arunachalam Linux - Software 4 10-12-2005 08:51 AM
is shared memory expandable in memory size? Thinking Programming 4 08-16-2005 09:57 AM
Shared memory size limit? nodger Programming 1 03-16-2005 08:28 AM
allocating memory eshwar_ind Programming 6 02-26-2004 07:06 AM


All times are GMT -5. The time now is 06:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration