shmat failed due to Cannot allocate memory

 
Thread Tools Search this Thread
Operating Systems Linux SuSE shmat failed due to Cannot allocate memory
# 1  
Old 01-06-2011
shmat failed due to Cannot allocate memory

Hi,
My program was running for a whole night. after 12 hours i got an error message "Cannot allocate memory" during the shmat commmand. So can you please let me know what could be the reason? is there any solution?

thanks in advance.

Regards,
Mano
# 2  
Old 01-06-2011
You have a memory leak or need more swap space.
# 3  
Old 01-07-2011
but i had enough shared memory in the server... i mean if i do the cat /proc/sys/kernel/shmall the response is 1152921504606846720.

cat /proc/sys/kernel/shmmax
18446744073709551615
# 4  
Old 01-07-2011
SHMMAX may be set to allow 4398046511103 gigabytes of shared memory, you don't actually have 4398046511103 gigabytes of memory available. Go over the amount of memory and swap you have installed and you'll hit limits, not necessarily when you allocate it but later, when you try to use it... That's the sort of thing a slow memory leak could do overnight.

That number's related to the 64-bit maximum integer. Having SHMMAX set to that means 'no limit'.
# 5  
Old 01-07-2011
actually once i observed the problem from then on my program was not working due to same reason.

BTW, one more question is from the shmmax value i can see that its around some giga bytes. but that much memory is not available in the system. so it means will shmmax size will be set to 32MB(default shared memory maximum size)?

Once i got this issue, then on the same issue is continuously occuring till i restart the system.

---------- Post updated at 10:41 AM ---------- Previous update was at 10:39 AM ----------

ipcs command output:
ipcs -m
0x00000000 904855586 user 777 131072 2 dest
0x0052e2c1 1401815075 user 600 37879808 5
0x0000f24f 1401847844 root 644 28 22
0x00238003 1401880613 root 644 16 2
0x00000000 1402142758 user 777 12096 2 dest
0x00000000 1291714599 user 777 15840 2 dest
# 6  
Old 01-07-2011
Memory leaks and swap space are about VM limits. A 32 bit program cannot allocate more than 2-4 GBytes of space, if it does not run out of swap first. Of course, this has nothing to do with "shared memory", it has to do with overhead malloc() calls to support that "shared memory".

You just decide either there is a need for that much VM in your app and you need 64 bit code or bigger swap space, or if it signifies a failure to free() or delete.

(BTW, "shared memory" is, in my opinion, too root-dependent, system setup dependent, and since mmap() and mmap64(), very obsolete!)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

How to allocate memory to a string in C?

hi I want to take string as a input from user and the string is very very length. From the lengthy string i have to substring take first 16 letters, then next 8 letters,................... Please guide me how to write program to take lengthy string from user and sub string it. Thanks (4 Replies)
Discussion started by: atharalikhan
4 Replies

2. Linux

shmget failed - cannot allocate memory

Hi, In my proj, one process was running for 2 days. after 2 days its throwing an error message "shmget failed cannot allocate memory". the same problem happened every time.i.e. i can reproduce the same issue if my process is running for every 2 days for a same operation.Within this 2 days there... (1 Reply)
Discussion started by: ManoharanMani
1 Replies

3. Linux

shmget failed - cannot allocate memory

Hi, In my proj, one process was running for 2 days. after 2 days its throwing an error message "shmget failed cannot allocate memory". the same problem happened every time.i.e. i can reproduce the same issue if my process is running for every 2 days for a same operation.Within this 2 days there... (1 Reply)
Discussion started by: ManoharanMani
1 Replies

4. SuSE

shmget failed - cannot allocate memory

Hi, In my proj, one process was running for 2 days. after 2 days its throwing an error message "shmget failed cannot allocate memory". the same problem happened every time.i.e. i can reproduce the same issue if my process is running for every 2 days for a same operation.Within this 2 days there... (1 Reply)
Discussion started by: ManoharanMani
1 Replies

5. SuSE

Compile failed due to 'out of memory'

Maybe increase swap space will help? How to do it? When I install suse 11 on this box, I remeber it shows the swap space is 2G, I didn't find it anywhere now... (5 Replies)
Discussion started by: fld2007
5 Replies

6. UNIX for Advanced & Expert Users

Oracle how many memory allocate really

hi... i want to find oracle allocate how many memory really.. i execute this code to list memory on unix system : ps -eo pmem,args | sort -k 1 -r -n outputs ; %mem command 12.9|ora_smon_RTX 12.9|ora_s000_RTX 12.9|ora_reco_RTX 12.9|ora_qmnc_RTX... (2 Replies)
Discussion started by: utoptas
2 Replies

7. UNIX for Advanced & Expert Users

How to allocate memory

Hi, I have 2 systems with same hardware and software. One system is giving me error "Error occurred during initialization of VM Could not reserve enough space for object " when I tried to increase JBoss App's heap size to 2GB while the other system is running fine without any issue. Is there... (5 Replies)
Discussion started by: ravi3553
5 Replies

8. UNIX for Advanced & Expert Users

unable to allocate enough memory

On SunOS 5.8 I get an error when starting a large Java process with over 2Gb memory. Error occurred during initialization of VM Could not reserve enough space for object heap When stopping several other Java processes we can start this process. This seems to indicate that we don't have... (11 Replies)
Discussion started by: rein
11 Replies

9. Linux

shmat() Failure While Using a Large Amount of Shared Memory

Hi, I'm developing a data processing pipeline with multiple stages, with data being moved between the stages using shared memory segments. The size of the data is typically of the order of hundreds of megabytes, and there are typically a few tens of main shared memory segments each of size... (2 Replies)
Discussion started by: theicarusagenda
2 Replies

10. Programming

how allocate virtual memory

Hi Folks can any body suggest how to allocate virtual memory any function for that (2 Replies)
Discussion started by: munnu
2 Replies
Login or Register to Ask a Question