Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted (CodeIgniter + XML-RPC)

前端 未结 29 2562
天涯浪人
天涯浪人 2020-11-21 22:57

I have a bunch of client point of sale (POS) systems that periodically send new sales data to one centralized database, which stores the data into one big database for repor

29条回答
  •  梦毁少年i
    2020-11-21 23:47

    For those who are scratching their heads to find out why on earth this little function should cause a memory leak, sometimes by a little mistake, a function starts recursively call itself for ever.

    For example, a proxy class that has the same name for a function of the object that is going to proxy it.

    class Proxy {
    
        private $actualObject;
    
        public function doSomething() {
    
            return $this->actualObjec->doSomething();
        }
    }
    

    Sometimes you may forget to bring that little actualObjec member and because the proxy actually has that doSomething method, PHP wouldn't give you any error and for a large class, it could be hidden from the eyes for a couple of minutes to find out why it is leaking the memory.

提交回复
热议问题