


Fatal error: Out of memory (allocated 262144) (tried to allocate 10267220 bytes)解决方案
Fatal error: Out of memory (allocated 262144) (tried to allocate 10267220 bytes)
请问这个怎么办?
我在程序前面加一个代码
ini_set('memory_limit', '50M');
要怎样才能运行起来呢?
用的是虚拟主机,
------解决方案--------------------
这个不能这样设置的吧?或者有限制。最好是php.ini里去改,然后重启apache。
不知道ini_set里修改后,是否立即生效。有点悬。
------解决方案--------------------
你可以写段代码测试下的,,应该是可以的……ini_set没有被禁吧
看看是否报内存超出限制
ini_set('memory_limit', '1M');
for($i=0;$i{
$arr[] = $i;
}
------解决方案--------------------
1048576 bytes = 1024K = 1 M
说明设置有效果
1M只是方便测试
------解决方案--------------------
可以立即生效
echo ini_get('memory_limit');//原值
ini_set('memory_limit', '50M');
echo ini_get('memory_limit');//现值
但问题不在这里
Out of memory (allocated 262144) (tried to allocate 10267220 bytes)
是说你在 262144 字节可用内存中
试图申请 10267220 字节空间
这显然是不能够的
memory_limit 表示的是允许php使用的最大空间,并不是一定有 memory_limit 的内存供你使用
你的情况表示内存碎片太多
重启 web 服务应该可以缓解
如频繁发生,就需要考虑安装内存管理软件,或增加内存条了

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

"Detailed explanation of how to use take and limit in Laravel" In Laravel, take and limit are two commonly used methods, used to limit the number of records returned in database queries. Although their functions are similar, there are some subtle differences in specific usage scenarios. This article will analyze the usage of these two methods in detail and provide specific code examples. 1. Take method In Laravel, the take method is used to limit the number of records returned, usually combined with the orderBy method.

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

MySQL storage engine selection comparison: InnoDB, MyISAM and Memory performance index evaluation Introduction: In the MySQL database, the choice of storage engine plays a vital role in system performance and data integrity. MySQL provides a variety of storage engines, the most commonly used engines include InnoDB, MyISAM and Memory. This article will evaluate the performance indicators of these three storage engines and compare them through code examples. 1. InnoDB engine InnoDB is My

The win10 system is an excellent system that is worth using. Its strong compatibility and high intelligence can ensure that there will be basically no problems in the use of the win10 system. However, recently, many friends have reported that their computers frequently have blue disks. And it always prompts the error code memorymanagement. What's going on? Today, the editor will bring you the solution to the frequent blue screen of win10 and the memory management termination code. If you need a game, come and take a look. Solution to win10memorymanagement blue screen: Solution 1: 1. Use "Win key + R" + enter "control + enter" to enter the control surface

Methods to delete elements: 1. Use delete() to delete the specified element from the Set object, the syntax is "setObj.delete(value);"; 2. Use clear() to delete all elements in the Set object, the syntax is "setObj.delete(value);" "setObj.clear();".

This article is based on the basics of Python and introduces how to use dict and set. The dict using the key-value storage structure is very useful in Python. It is important to choose an immutable object as the key. The most commonly used key is a string.

In Laravel, we often use some methods to limit the number of query results, including take and limit methods. While they can both be used to limit the number of query results, they do have some subtle differences. In this article, we'll take a deep dive into how take and limit differ in Laravel, illustrating them with concrete code examples. First, let's look at the take method. The take method is part of Eloquent and is typically used for
