Re: malloc and 'Active' memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Jul 2005, Rick Stevens wrote:
> The question is what did MySQL do with the memory?  If it was left
> as a malloc'd region, it should get returned to the free pool by the
> garbage collection system but it's not instantaneous.  I'd wait a bit,
> then check the free space and try again.
> 
> If the memory was, instead, given over to some IPC mechansim (shared
> memory, unnamed pipes, messages, semaphores, etc.), then it won't be
> cleaned up and you'll have to kill those off manually with an ipcrm
> command (see "man ipcs", "man ipcrm" for details).
> 
> Of course, MySQL should trap all signals and, on receiving a SIGTERM,
> SIGHUP, SIGQUIT, etc., go to a routine that releases all of its memory
> before it terminates.  That's just good practice and something that is
> overlooked by many programmers far too often.


Hi Rick,

Thanks for your answer. I'd like to clear things up: I don't think it's
MySQL that's not releasing the memory. I can do a clean boot of the
machine without MySQL running (chkconfig off'ed), do a couple of compiles
and see the 'Active' memory in /proc/meminfo rising steadily towards 6GB.  
If I try to start MySQL after all this, it won't start because the malloc
fails. After a reboot I can start MySQL again.

So basically this brings my question down to: is there some way to find
out why such a huge amount of memory is being 'Active' and would it be
possible to see what it is used for (I looked at slabtop, but 'Active'
memory obviously isn't 'Slab')? Secondly, why doesn't a malloc reclaim the
'Active' memory?

Currently the machine has been inactive for all night, and the 'Active' 
memory hasn't decreased:

MemTotal:      8124080 kB
MemFree:        629756 kB
Buffers:        209596 kB
Cached:         681684 kB
SwapCached:          0 kB
Active:        5727524 kB
Inactive:      1475676 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      8124080 kB
LowFree:        629756 kB
SwapTotal:           0 kB
SwapFree:            0 kB
Dirty:               0 kB
Writeback:           0 kB
Mapped:          17884 kB
Slab:           278508 kB
CommitLimit:   4062040 kB
Committed_AS:    20888 kB
PageTables:       1056 kB
VmallocTotal: 34359738367 kB
VmallocUsed:       288 kB
VmallocChunk: 34359738043 kB
HugePages_Total:     0
HugePages_Free:      0
Hugepagesize:     2048 kB


And there are no processes taking any substantial amount of memory:

[matthijs@www26 ~]$ ps -e --format 'pid cmd %mem'
  PID CMD                         %MEM
    1 init [3]                     0.0
    2 [migration/0]                0.0
    3 [ksoftirqd/0]                0.0
    4 [migration/1]                0.0
    5 [ksoftirqd/1]                0.0
    6 [events/0]                   0.0
    7 [events/1]                   0.0
    8 [khelper]                    0.0
    9 [kthread]                    0.0
   14 [kacpid]                     0.0
   98 [kblockd/0]                  0.0
   99 [kblockd/1]                  0.0
  102 [khubd]                      0.0
  150 [pdflush]                    0.0
  151 [pdflush]                    0.0
  154 [aio/0]                      0.0
  155 [aio/1]                      0.0
  152 [kswapd1]                    0.0
  153 [kswapd0]                    0.0
  232 [kseriod]                    0.0
  394 [scsi_eh_0]                  0.0
  415 [kjournald]                  0.0
  942 kmodule -d                   0.0
  954 udevd                        0.0
  990 [shpchpd_event]              0.0
 1105 [kjournald]                  0.0
 1106 [kjournald]                  0.0
 1384 syslogd -m 0                 0.0
 1386 klogd -x                     0.0
 1496 /usr/sbin/sshd               0.0
 1520 ntpd -u ntp:ntp -p /var/run  0.0
 1536 sendmail: accepting connect  0.0
 1542 sendmail: Queue runner@01:0  0.0
 1562 crond                        0.0
 1659 dbus-daemon --system         0.0
 1666 hald --retain-privileges     0.0
 1671 hald-addon-acpi              0.0
 1686 hald-addon-storage           0.0
 1693 /sbin/mingetty tty1          0.0
 1694 /sbin/mingetty tty2          0.0
 1695 /sbin/mingetty tty3          0.0
 1696 /sbin/mingetty tty4          0.0
 1697 /sbin/mingetty tty5          0.0
 1698 /sbin/mingetty tty6          0.0
 1851 [kauditd]                    0.0
 2469 [kjournald]                  0.0
26283 sshd: matthijs [priv]        0.0
26285 sshd: matthijs@pts/0         0.0
26286 -bash                        0.0
26685 ps -e --format pid cmd %mem  0.0


I am still unable to start MySQL...


Best regards,

-- 
Matthijs van der Klip
System Administrator
Spill E-Projects
The Netherlands




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux