How to change mapped memory?

Forum for questions and support relating to the 1.25.x releases only.
Locked
gmar_87
Posts: 72
Joined: Sat Aug 13, 2011 11:38 pm
Location: Melbourne, Australia

How to change mapped memory?

Post by gmar_87 »

I am trying to get some spare USB webcams working with ZoneMinder, but having some problems. I can get one sort of working at 320x240 but if i increase pixels or image frame size i get the following in the syslog.

Code: Select all

2011-09-13 19:39:41.584021	zma_m2	2087	ERR	Got unexpected memory map file size 23041284, expected 5761284	zm_monitor.cpp	364
Is it possible to increase mapped memory? If so, how?
gmar_87
Posts: 72
Joined: Sat Aug 13, 2011 11:38 pm
Location: Melbourne, Australia

Re: How to change mapped memory?

Post by gmar_87 »

I installed ZoneMinder 1.25.0 with

Code: Select all

./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin \
ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser \
ZM_DB_PASS=zmpass ZM_SSL_LIB=openssl --enable-debug=no \
--with-webgroup=www-data --with-webuser=www-data --enable-mmap CPPFLAGS="-D__STDC_CONSTANT_MACROS ${CPPFLAGS}"
I just noticed --enable-mmap doesn't have "=yes". Does this mean i'm not using it..?

I added the following to /etc/sysctl.conf

Code: Select all

kernel.shmmax = 167772160
Rebooted, but still getting

Code: Select all

Sep 13 22:05:39 ZONEMINDER1 zmc_dvideo0[3783]: ERR [Got unexpected memory map file size 6913364, expected 9217524]
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: How to change mapped memory?

Post by mastertheknife »

gmar_87 wrote:I am trying to get some spare USB webcams working with ZoneMinder, but having some problems. I can get one sort of working at 320x240 but if i increase pixels or image frame size i get the following in the syslog.

Code: Select all

2011-09-13 19:39:41.584021	zma_m2	2087	ERR	Got unexpected memory map file size 23041284, expected 5761284	zm_monitor.cpp	364
Is it possible to increase mapped memory? If so, how?
You need to restart ZM after changing settings such as the resolution.

mastertheknife
Kfir Itzhak.
gmar_87
Posts: 72
Joined: Sat Aug 13, 2011 11:38 pm
Location: Melbourne, Australia

Re: How to change mapped memory?

Post by gmar_87 »

mastertheknife wrote:
gmar_87 wrote:I am trying to get some spare USB webcams working with ZoneMinder, but having some problems. I can get one sort of working at 320x240 but if i increase pixels or image frame size i get the following in the syslog.

Code: Select all

2011-09-13 19:39:41.584021	zma_m2	2087	ERR	Got unexpected memory map file size 23041284, expected 5761284	zm_monitor.cpp	364
Is it possible to increase mapped memory? If so, how?
You need to restart ZM after changing settings such as the resolution.

mastertheknife
I have tried restarting zm service and rebooting the server after the changes, but still same problem...
User avatar
nightcrawler
Posts: 71
Joined: Fri Aug 12, 2011 9:54 am
Location: the netherlands

Re: How to change mapped memory?

Post by nightcrawler »

gmar,
Mapped memory allows you to use a special type of file as the placeholder for your memory and this file is "mapped" into memory space for easy and fast access.
To enable mapped memory in Zoneminder you need to add the

Code: Select all

--enable--mmap=yes
switch to your configure line. IE: etc/zm/zm.conf

look if your linux has an mmap drive. usualy it is like /dev/shm. (see the wiki: http://www.zoneminder.com/wiki/index.php/FAQ for mmap)
You can check it with command:

Code: Select all

mount | grep shm
An line is send back if you have it like :

Code: Select all

none on /dev/shm type tmpfs (rw,nosuid,nodev,size=512mb)
look to the size! if it's less then your system RAM than Increase it with an remount command

Code: Select all

# mount -o remount,size=1G /dev/shm 
and check it again


Now set in Zoneminder options path > PAT_MAP to /dev/shm (default!) and restart ZoneMinder, to check the memory slices use "df" and relating to just ZM type

Code: Select all

ls -l /dev/shm/zm*
(you can leave the /zm* out of it if you want to see other users of the swap space)

and if it's set you can increase your camera resolution,buffer etc. if the cam stops working restart zoneminder like mastertheknife says in his post. the mmap only increase if you restart ZoneMinder.
(It personally has takes me a few days of google-in before I found this "bug").
Zoneminder @Ubuntu 11 server, ZM 1.25.0 , FFMPEG, 4 Analoge cameras, 1.6ghz P4mobile, 2GB ram, 60GB-HDD.
I also have an (homeseer) domotica system up-and-running with touchscreens,light controllers,weather forecast etc.
gmar_87
Posts: 72
Joined: Sat Aug 13, 2011 11:38 pm
Location: Melbourne, Australia

Re: How to change mapped memory?

Post by gmar_87 »

nightcrawler wrote:gmar,
Mapped memory allows you to use a special type of file as the placeholder for your memory and this file is "mapped" into memory space for easy and fast access.
To enable mapped memory in Zoneminder you need to add the

Code: Select all

--enable--mmap=yes
switch to your configure line. IE: etc/zm/zm.conf

look if your linux has an mmap drive. usualy it is like /dev/shm. (see the wiki: http://www.zoneminder.com/wiki/index.php/FAQ for mmap)
You can check it with command:

Code: Select all

mount | grep shm
An line is send back if you have it like :

Code: Select all

none on /dev/shm type tmpfs (rw,nosuid,nodev,size=512mb)
look to the size! if it's less then your system RAM than Increase it with an remount command

Code: Select all

# mount -o remount,size=1G /dev/shm 
and check it again


Now set in Zoneminder options path > PAT_MAP to /dev/shm (default!) and restart ZoneMinder, to check the memory slices use "df" and relating to just ZM type

Code: Select all

ls -l /dev/shm/zm*
(you can leave the /zm* out of it if you want to see other users of the swap space)

and if it's set you can increase your camera resolution,buffer etc. if the cam stops working restart zoneminder like mastertheknife says in his post. the mmap only increase if you restart ZoneMinder.
(It personally has takes me a few days of google-in before I found this "bug").
Thanks for the advice nightcrawler. Sorry i didn't get back to you sooner!

Can i just add --enable--mmap=yes to the end of zm.conf?
BTW, my zm.conf is in \usr\local\etc

Code: Select all

df -h
Output =
none 1.5G 73M 1.5G 5% /dev/shm

Code: Select all

mount | grep shm
Output = none on /dev/shm type tmpfs (rw,nosuid,nodev)
There is no size mentioned.

Code: Select all

 ls -al /dev/shm
Output =

Code: Select all

total 74424
drwxrwxrwt  2 root     root          100 2011-10-10 19:55 .
drwxr-xr-x 19 root     root         4340 2011-10-08 11:17 ..
-rw-------  1 www-data www-data 36865524 2011-10-11 08:45 zm.mmap.1
-rw-------  1 www-data www-data 36865524 2011-10-11 08:46 zm.mmap.2
-rw-------  1 www-data www-data  2305044 2011-10-10 19:55 zm.mmap.9
From web interface Options>Paths>PATH_MAP is already set to /dev/shm
Locked