Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e7e9723f
Commit
e7e9723f
authored
Jun 18, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Application::$reservedMemorySize.
parent
732e4384
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
Application.php
framework/yii/base/Application.php
+10
-3
No files found.
framework/yii/base/Application.php
View file @
e7e9723f
...
...
@@ -54,6 +54,13 @@ abstract class Application extends Module
* If this is false, layout will be disabled.
*/
public
$layout
=
'main'
;
/**
* @var integer the size of the reserved memory. A portion of memory is pre-allocated so that
* when an out-of-memory issue occurs, the error handler is able to handle the error with
* the help of this reserved memory. If you set this value to be 0, no memory will be reserved.
* Defaults to 256KB.
*/
public
$reservedMemorySize
=
262144
;
/**
* @var string Used to reserve memory for fatal error handler.
...
...
@@ -125,9 +132,9 @@ abstract class Application extends Module
ini_set
(
'display_errors'
,
0
);
set_exception_handler
(
array
(
$this
,
'handleException'
));
set_error_handler
(
array
(
$this
,
'handleError'
),
error_reporting
());
// Allocating twice more than required to display memory exhausted error
// in case of trying to allocate last 1 byte while all memory is taken. 1024 * 256 bytes
$this
->
_memoryReserve
=
str_repeat
(
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
,
1024
);
if
(
$this
->
reservedMemorySize
>
0
)
{
$this
->
_memoryReserve
=
str_repeat
(
'x'
,
$this
->
reservedMemorySize
);
}
register_shutdown_function
(
array
(
$this
,
'handleFatalError'
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment