title: Laravel Excel - Allowed memory exhausted even with WithChunkReading concern in place
body: <p>I'm trying to import an Excel file with 2 sheets both with 700 rows but memory runs out. I cannot increase memory limit since this is on a shared host.</p>
  
  <p>Works fine on my Homestead though. </p>
  
  <p>I'm not sure if the WithChunkReading is working or not. The code below is for importing the first sheet.</p>
  
  <pre class="lang-php prettyprint-override"><code>use Maatwebsite\Excel\Concerns\ToModel;
  use Maatwebsite\Excel\Concerns\WithBatchInserts;
  use Maatwebsite\Excel\Concerns\WithChunkReading;
  use Maatwebsite\Excel\Concerns\WithHeadingRow;
  use PhpOffice\PhpSpreadsheet\Shared\Date as ExcelDate;
  
  class SummaryImport implements ToModel, WithHeadingRow, WithChunkReading, WithBatchInserts
  {
  
      public function model(array $row)
      {
          $raw_date = $row['date_assigned_mmddyy'];
  
          try{
              $formatted = ($raw_date!='') ? Carbon::parse($raw_date)-&gt;toFormattedDateString() : '';
  
          }catch (\Exception $exception){
  
              try {
                  $dt = ExcelDate::excelToDateTimeObject($raw_date);
                  $formatted = Carbon::parse($dt)-&gt;toFormattedDateString();
              }
              catch (Exception $e){
                  Log::info($e-&gt;getMessage());
                  $formatted = '';
              }
  
          }
  
  
          Card::updateOrCreate(
              ['card_number'=&gt;$row['card']],
              [
                  'customer_name'=&gt; $row['customer_name'],
                  'cs_number'=&gt; $row['plate_or_cs'],
                  'date_assigned'=&gt; ($formatted == 'Jan 1, 1970') ? '': $formatted
              ]
          );
  
  
      }
  
  
  
      public function chunkSize(): int
      {
          return 100;
      }
  
      public function batchSize(): int
      {
          return 100;
      }
  }
  </code></pre>
  
  <p>This one is for importing the second sheet.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Imports;
  
  use App\Card;
  use App\PointPeso;
  use Maatwebsite\Excel\Concerns\ToModel;
  use Maatwebsite\Excel\Concerns\WithBatchInserts;
  use Maatwebsite\Excel\Concerns\WithChunkReading;
  use Maatwebsite\Excel\Concerns\WithHeadingRow;
  
  class PointsPesoImport implements ToModel, WithHeadingRow, WithChunkReading, WithBatchInserts
  {
  
      public function model(array $row)
      {
  
          $card = Card::where('card_number','=', $row['card'])-&gt;get();
  
          if(count($card)){
  
              PointPeso::updateOrCreate(
                  ['card_id'=&gt;$card[0]-&gt;id],
                  [
                      'total_points'=&gt;$row['total_points']!=null ? $row['total_points']: '0',
                      'total_peso_value'=&gt;$row['total_peso_value']!=null ? $row['total_peso_value']: '0'
                  ]
              );
  
          }
      }
  
  
      public function chunkSize(): int
      {
          return 100;
      }
  
      public function batchSize(): int
      {
          return 100;
      }
  
  }
  </code></pre>
  
  <p>This is the Error Log:</p>
  
  <pre><code>[26-Aug-2019 05:34:02 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) in /home1/synergj0/websites/poinstchecker/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php on line 1262
  [26-Aug-2019 05:34:03 UTC] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /home1/synergj0/websites/poinstchecker/vendor/symfony/http-foundation/AcceptHeaderItem.php on line 1
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Imports;
  
  use Maatwebsite\Excel\Concerns\WithMultipleSheets;
  
  class CardsImport implements WithMultipleSheets
  {
  
      public function sheets(): array
      {
          return [
              'Summary' =&gt; new SummaryImport,
              'Points Peso Monitoring' =&gt; new PointsPesoImport,
          ];
      }
  
  }
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\Http\Requests\UploadRequest;
  use App\Imports\CardsImport;
  use Maatwebsite\Excel\Facades\Excel;
  
  
  class UploadsController extends Controller
  {
      public function upload_form(){
          return view('uploader.uploader');
      }
  
      public function upload(UploadRequest $request){
  
          Excel::import(new CardsImport, $request-&gt;file('excel'));
  
          return redirect()-&gt;route('summary');
      }
  
  }
  </code></pre>