search
HomeDatabaseMysql Tutorialmysqld-nt: Out of memory (Needed 1677720 bytes)解决方法_MySQL

今天发现网站有点慢,发现mysql日志中提示mysqld-nt: Out of memory (Needed 1677720 bytes),经排查是由于最近调整了mysql的一些参数导致,以为内存大就不怕了,32位系统真心内容利用率很低,据说不超过4G,我们的32G内存真浪费了,以后还是使用win2008 r2或centos系统做服务器吧。废话不多说下面为大家分享下解决方法:

因为mysql版本不同可能配置略有区别,主要就是设置如下参数

key_buffer、key_buffer_size、read_buffer_size、sort_buffer_size记住了有这个参数的就改,没有也不要添加。修改后一般是降低,然后重启mysql服务即可。

核心提示:检查mysqld配置my.conf,着重看key_buffer_size, max_heap_table_size, tmp_table_size几个参数,推荐设置key_buffer_size值为max_heap_table_size的1/4.

因为服务器内存而大富余比较多,前些天把my.conf里的好几个参数调得相当大,1G甚至2G,但并不稳定,mysqld报出过几次Out of memory (Needed xxx bytes)这样的错误,分析原因时,想到是32位linux系统上的linux不支持PAE,不能使用超过3G以上的内存,所以把改大的几个参数适当改小了点,最大也只有几百M的样子,但还是出现过几次Out of memory错误。于是网上多方查询,后来受到公式

key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections

的启发,两次检查了key_buffer_size, max_heap_table_size, tmp_table_size几个参数,发现这三个值的设置是一样的,竟然都是512M!

于是改小key_buffer_size到128M,重启mysqld接下来5个小时的监测,没有再发生类似错误。

改了这几个参数后,还是有一条是Out of memory ,继续检查,发现innodb_buffer_pool_size = 1512M,于是我改为1000M,再启Mysql居然好了。

注:这台服务器一共了才3G内存:最终大至如下

key_buffer = 200M
key_buffer_size = 1294963200
#max_join_size = 4294967295
max_join_size = 1294967295
max_allowed_packet = 1M
#table_open_cache = 512
table_cache = 512
sort_buffer_size = 2294967295
read_buffer_size = 2147479552
#write_buffer_size = 4294967295
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M

php错误Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes

php运行一段时候后出现错误:

php错误Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes

意思是说:致命错误,超出内存,已经分配allocated 262144,尝试分配19456 字节。

解决方法是修改php.ini,加大memory_limit

刚刚着实吓我一跳,html可以正常访问,php不行,我还以为是受攻击呢。

后来看到www.blogguy.cn 上不去了Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes,知道是内存不足导致的,可是vps也连不上去,也看不到到底是谁在占内存,只能进网站后台重启vps,就不知道问题出在哪儿了。记录下来备案!

修改方法

修改php.ini

如下的区域

max_execution_time = 120 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

根据需要调整。

重启一下apache就可以了。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
CAMM2 for desktop PCs: MSI explains the benefits of the new RAM standard for gaming towersCAMM2 for desktop PCs: MSI explains the benefits of the new RAM standard for gaming towersAug 17, 2024 pm 06:47 PM

The first LPCAMM2 modules for laptops are already being delivered, and desktop mainboards are also expected to be equipped with CAMM2 in future. CAMM2 and LPCAMM2 are not compatible with each other, and even on desktop PCs, customers need to be caref

主板上的数字音频输出接口-SPDIF OUT主板上的数字音频输出接口-SPDIF OUTJan 14, 2024 pm 04:42 PM

主板上SPDIFOUT连接线序最近我遇到了一个问题,就是关于电线的接线顺序。我上网查了一下,有些资料说1、2、4对应的是out、+5V、接地;而另一些资料则说1、2、4对应的是out、接地、+5V。最好的办法是查看你的主板说明书,如果找不到说明书,你可以使用万用表进行测量。首先找到接地,然后就可以确定其他的接线顺序了。主板vdg怎么接线连接主板的VDG接线时,您需要将VGA连接线的一端插入显示器的VGA接口,另一端插入电脑的显卡VGA接口。请注意,不要将其插入主板的VGA接口。完成连接后,您可以

out和in接口是什么意思out和in接口是什么意思Sep 28, 2021 pm 04:39 PM

out接口指的是输出接口,in接口指的是输入接口。out接口一般代表着音源线路输出接口,用来接负载,例音箱、耳机等;而in接口一般代表着音源线路输入接口,用来接CD机、手机、MP3、电脑等。

win10内存管理引发的蓝屏问题win10内存管理引发的蓝屏问题Dec 30, 2023 pm 07:11 PM

win10系统是一款非常值得使用的优秀系统,强大的兼容性和高智能可以确保win10系统在使用中基本不会出现什么问题,但近日却有很多小伙伴们反应自己的电脑出现了频繁蓝盘并且老是提示错误代码memorymanagement这是怎么回事呢?今天小编就为大家带来了win10频繁蓝屏并且出现了memorymanagement终止代码的解决办法游戏需要的话就快来看看吧。win10memorymanagement蓝屏的解决办法:解决方法一:1、使用“Win键+R”+输入“control+enter”进入控制面

MySQL储存引擎选型对比:InnoDB、MyISAM与Memory性能指标评估MySQL储存引擎选型对比:InnoDB、MyISAM与Memory性能指标评估Jul 26, 2023 am 11:25 AM

MySQL储存引擎选型对比:InnoDB、MyISAM与Memory性能指标评估引言:在MySQL数据库中,储存引擎的选择对于系统性能和数据完整性起着至关重要的作用。MySQL提供了多种储存引擎,其中最常用的引擎包括InnoDB、MyISAM和Memory。本文将就这三种储存引擎进行性能指标评估,并通过代码示例进行比较。一、InnoDB引擎InnoDB是My

PHP Fatal error: Allowed memory size of的解决方法 bytes exhausted的解决方法PHP Fatal error: Allowed memory size of的解决方法 bytes exhausted的解决方法Jun 22, 2023 am 08:13 AM

PHP是一种广泛使用的服务器端脚本语言,但是在运行PHP应用程序时,可能会遇到‘PHPFatalerror:Allowedmemorysizeofbytesexhausted’的错误信息,这通常意味着内存分配问题。在本文中,我们将探讨一些常见的导致‘PHPFatalerror:Allowedmemorysizeofbytese

win10系统闪退显示out of memory怎么办?win10系统闪退显示out of memory怎么办?Feb 09, 2024 pm 03:00 PM

win10系统闪退显示outofmemory,近期很多的用户在使用电脑的时候,出现了这个提示,导致需要经常的重启进行修复,那么这种情况我们应该如何处理,针对这个问题,本期的win10教程就来和广大用户们分享完整操作步骤,希望能够帮助更多的小伙伴解决问题。win10系统闪退显示outofmemory怎么办1、右击桌面上的此电脑,选择选项列表中的“属性”。2、进入到新的窗口界面后,点击左上角的“高级系统设置”选项。3、在打开的窗口中,切换到上方中的“

C语言中go out的用法详解C语言中go out的用法详解Mar 14, 2024 am 08:27 AM

在C语言中,"goout"是一个常用的术语,指的是函数的退出和返回值的传递。在本文中,我们将详细解释C语言中"goout"的用法,并提供具体的代码示例。在C语言中,函数的返回值通过return语句传递给调用函数。return语句用于终止函数的执行,并返回一个值给调用者。在函数体中的任何地方都可以使用return语句,但一般我们会在函数的末尾使用它来返回最

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.