DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 17th September 2016
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default Memory allocation error

Quite often I see this when I start vim -g (while running X, obviously):

Gdk-WARNING **: shmget failed: error 12 (Cannot allocate memory)

Googling shows someone with the same error on FSBSD, but no obvious solution.
In spite of the error, vim -g opens and works normally, so I don't know how much it matters. But is there any way to fix it? (Stopping firefox makes it go away.)
Reply With Quote
  #2   (View Single Post)  
Old 17th September 2016
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

You can try increasing the size of the shared memory. The sysctl manpage lists an example:


Code:
To set the amount of shared memory available in the system and the
maximum number of shared memory segments:
# sysctl kern.shminfo.shmmax=33554432 
# sysctl kern.shminfo.shmseg=32
It also lists some other kern.shminfo.* options.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 17th September 2016
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

Thanks very much - that was what I was looking for. I wonder why the default values are so seemingly arbitrary?
Reply With Quote
  #4   (View Single Post)  
Old 17th September 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by acampbell View Post
...I wonder why the default values are so seemingly arbitrary?
You can look through the source code and the CVS logs, and even contact the developers directly, if you are interested in the implementation and have specific questions. /usr/src/sys/kern/sysv_shm.c and /usr/src/sys/sys/shm.h might be good starting points.
Reply With Quote
  #5   (View Single Post)  
Old 18th September 2016
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

Thanks for this. Actually my question was more basic/ignorant - why 33554432? But after more digging on google I found at least part of the answer: it's a multiple of the page size, 4096.
Reply With Quote
  #6   (View Single Post)  
Old 18th September 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

The value is exactly 32 megabytes, in decimal.

But my reply above was really to remind everyone that OpenBSD is open. We can review the source code, and review all changes made to it back through time to its original import into the tree, and ask questions of any of the involved developers about their design decisions.

The cvs(1) annotate shows you who touched any line of code and when, and the cvs(1) log command shows you why the line was touched. They are very useful together.

---

The cvs(1) annotate command is hard for me to remember, so I always use its synonym: cvs(1) blame.

Last edited by jggimi; 18th September 2016 at 12:58 PM. Reason: added "and when"
Reply With Quote
  #7   (View Single Post)  
Old 20th September 2016
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

The default Linux limit for shared memory is effectively infinite. I'm not sure if process memory limits are enforced for shared memory, but I don't think they are. What this would mean is that a single program could allocate several gigabytes of memory and crash or kill itself without cleaning that up. Oops! Try to clean up that mess without a reboot ;-)
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD automatic disklabel allocation J65nko Guides 0 22nd February 2016 01:50 PM
hello, how BSD reboot but keep memory misssir FreeBSD General 8 11th October 2011 02:43 PM
shc unistd.h:239: error: syntax error before '&' token laraaj OpenBSD General 3 11th September 2010 07:21 AM
Memory Not Detected jrs OpenBSD Installation and Upgrading 3 19th May 2009 05:50 PM
Memory cache graudeejs FreeBSD General 3 9th July 2008 03:27 AM


All times are GMT. The time now is 05:44 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick