bug #31632 [Messenger] Use "real" memory usage to honor --memory-limit (chalasr)

This PR was merged into the 4.2 branch.

Discussion
----------

[Messenger] Use "real" memory usage to honor --memory-limit

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/29957
| License       | MIT
| Doc PR        | n/a

At least it's consistent with what other daemon-based libraries do:
https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/enqueue/Consumption/Extension/LimitConsumerMemoryExtension.php#L58
https://github.com/M6Web/DaemonBundle/blob/master/src/M6Web/Bundle/DaemonBundle/Command/DaemonCommand.php#L493

Commits
-------

fbfe2dfa8a [Messenger] Use real memory usage for --memory-limit
This commit is contained in:
Fabien Potencier 2019-05-27 07:52:11 +02:00
commit ac4429a6aa
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ class StopWhenMemoryUsageIsExceededReceiver implements ReceiverInterface
$this->memoryLimit = $memoryLimit;
$this->logger = $logger;
$this->memoryResolver = $memoryResolver ?: function () {
return \memory_get_usage();
return \memory_get_usage(true);
};
}