Uploaded image for project: 'PHP ORMs'
  1. PHP ORMs
  2. PHPORM-184

laravel-mongodb - Issue #2959: Memory leak when setting nested keys using dot notation

    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      raducorcan has created Issue #2959: Memory leak when setting nested keys using dot notation in laravel-mongodb. This Jira ticket was filed by GromNaN

      Issue Text:

      • Laravel-mongodb Version: 4.3.0
      • PHP Version: 8.3
      • Database Driver & Version: 1.15.0 & 5.0

      Description:

      There appears to be a memory leak when setting nested keys using dot notation. I am attaching a very simple code snippet that exemplifies the issue.

      Steps to reproduce

      ```
      class A extends \MongoDB\Laravel\Eloquent\Model {};

      $a = new A;
      for ($i = 0; $i < 100; $i++)

      { $a['somerandomkey'] = 42; echo (memory_get_usage() / (1024*1024) . "\n"); // this prints the same value in every iteration }

      //----------------------------------

      class A extends \MongoDB\Laravel\Eloquent\Model {};

      $a = new A;
      for ($i = 0; $i < 100; $i++)

      { $a['some.random.key'] = 42; echo (memory_get_usage() / (1024*1024) . "\n"); // this prints increasingly larger values }

      ```

      Expected behaviour

      Script memory usage keeps increasing.

      Actual behaviour

      The memory usage should remain constant.

            Assignee:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: