I really need some help on this one. My PHP program (it's a bit large, so I can't show all of it here) errors out with
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 16777216 bytes) in /path/program.php on line 81
This sounds like a valid error at face value, but I'm trying to do
$error = new message();
on line 81, and message is defined as
class message {
public $pos = -1;
public $severity = 0;
public $msg = "";
}
Why would this result in allocating 16777216 bytes? What am I doing wrong? How can I keep the memory use down to a sane amount?
I did try searching, but the only articles I found about huge memory allocations were from people actually trying to allocate such large chunks! So that wasn't much help.
Edit: found out I had a bug in my program that caused an infinite number of messages to be created. The question still hasn't been answered though, why does it say it tries to allocate 16777216 bytes, while one message takes up only 184 bytes? Even the many answers to the linked question don't address this.