How to track or correct the error "Allowed memory size" on the site on 1c-bitrix?

If some time to walk around the site and putting items in the shopping cart(not sure that's relevant, but the error occurs in the module sale), then this error occurs. Unfortunately, competence is not enough to find her.

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /var/www/ofcydev/bitrix/modules/sale/lib/discount.php(2554) : eval()'d code on line 1

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /var/www/ofcydev/bitrix/modules/main/lib/diag/exceptionhandlerlog.php on line 1
June 5th 19 at 21:38
3 answers
June 5th 19 at 21:40
You NEED to understand where poorly written code.
Guess for some reason is not possible.
For example, I saw a count of the number of records read via all of them, people just didn't know
about select count()
The catch is that I did not write, and even so. I went around all the code. Have any idea where exactly it can be.

Here are the General code where the error happens
protected function checkDiscountConditions()
{

 $checkOrder = null;

 $key = $this->enableCheckingPrediction? 'PREDICTIONS_APP' : 'UNPACK';

 if (empty($this->currentStep['discount'][$key]))
 return false;

eval('$checkOrder='.$this->currentStep['discount'][$key].';');
 if (!is_callable($checkOrder))
 return false;
 $result = $checkOrder($this->orderData);
unset($checkOrder);
 return $result;
 }
- loyce commented on June 5th 19 at 21:43
and finally not enough memory not necessarily here
example.
initialization 6 meters.
a bunch of code theduma little bit
hapnuli 220 meters
and we had to go very far until we spent another 30. - Thomas.Swi commented on June 5th 19 at 21:46
June 5th 19 at 21:42
Forgot to specify the problem is not memory allocation, do not highlight anything eats
C eval all logical really. This function checks discount conditions
protected function checkDiscountConditions()
{

 $checkOrder = null;

 $key = $this->enableCheckingPrediction? 'PREDICTIONS_APP' : 'UNPACK';

 if (empty($this->currentStep['discount'][$key]))
 return false;

eval('$checkOrder='.$this->currentStep['discount'][$key].';');
 if (!is_callable($checkOrder))
 return false;
 $result = $checkOrder($this->orderData);
unset($checkOrder);
 return $result;
 }

Here $this->currentStep['discount'][$key] can come in any condition
Try to start to zakamentuj the whole code in a function, and then pieces of code, such as the second part.. for Example eval - loyce commented on June 5th 19 at 21:45
June 5th 19 at 21:44
The Profiler help

Find more questions by tags PHP1C-Bitrix