Bug #1694 Crash error message is misleading
Submitted: 28 Oct 2003 23:30 Modified: 4 Aug 2005 2:56
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:3.23 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[28 Oct 2003 23:30] Peter Zaitsev
Description:
The message printed during the crash prints estimate of memory MySQL may consume.

There are two problems about it
1) It is just computed wrong:

mysqld got signal 11;This could be because you hit a bug. It is also possible that this binaryor one of the libraries it was linked against is corrupt, improperly built,or misconfigured. This error can also be caused by malfunctioning hardware.We will try our best to scrape up some info that will hopefully helpdiagnosethe problem, but since we have already crashed, something is definitelywrongand this may fail.
key_buffer_size=536870912
read_buffer_size=2093056
max_used_connections=208
max_connections=1500
threads_connected=54
It is possible that mysqld could use up tokey_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections =2467972 Kbytes of memory
Hope that's ok; if not, decrease some variables in the equation.

As you might check even not taking into account sort_buffer_size  the expression value is much higher than 2.4G printed. The problem is unsigned int is used 
for computation so results are wrapped.

2) This estimation is just totally wrong not taking into account innodb_buffer,
query_cache, temporary tables, per thread variable values.  

How to repeat:
Set large buffers, max_connections, start MySQL  crash it with kill -11 to emulate sigsegv

Suggested fix:
1) Change expression type to unsigned long long 

2) Add more variables to expressions or (better) add getrusage() call to print
actual memory consumed at the time of crash.
[5 Oct 2008 11:16] Konstantin Osipov
Bug#27593 On a crash, the memory statistics calculation differs from other documentation was marked a duplicate of this bug.
[21 Aug 2013 22:19] Roel Van de Paar
Bug#35661 legacy and incorrect memory formula and message written to error log after crash
[22 Jan 2015 2:57] Roel Van de Paar
http://bugs.mysql.com/?id=75536