Re: Memory alloaction issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
arivu
Forum Newbie
Posts: 4
Joined: Tue Jun 17, 2014 1:45 am

Re: Memory alloaction issue

Post by arivu »

Hi,

I am using the function explode or preg_split. I am getting error as "Allowed memory size of 268435456 bytes exhausted (tried to allocate 131223 bytes)" in the following line.

$explode_text = explode("|", $text);
$explode_text = preg_split("/\|+/", $content);

How to solve this issue. with out increasing the size of the memory?

Kindly help me.

thanks,
arivu
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Re: Memory alloaction issue

Post by requinix »

Don't hijack threads.

$text/content is too large to hold another copy of it in memory. Find another solution to your problem that doesn't involve explode() or preg_split().
If you need help with that, an explanation of what you're dealing with would be appreciated.
arivu
Forum Newbie
Posts: 4
Joined: Tue Jun 17, 2014 1:45 am

Re: Memory alloaction issue

Post by arivu »

Hi,

I am getting error while adding the bulk content.

"Allowed memory size of 268435456 bytes exhausted (tried to allocate 131223 bytes)" in the following line.
$explode_text = explode("|", $content);
$explode_text = preg_split("/\|+/", $content);

Increase the memory is the solution for this issue.
But this plugin needs to work in Shared hosting environments, i can't increase a VPS to that much memory.

So kindly give solution for this issue,

Thanks,
arivu
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Memory alloaction issue

Post by Celauran »

Increase the memory is the solution for this issue.
No, throwing hardware at a problem is not really a solution. You haven't shown us what you're trying to do or why you're trying to do it that way, so we can't help you. We've got nothing to work with.
arivu
Forum Newbie
Posts: 4
Joined: Tue Jun 17, 2014 1:45 am

Re: Memory alloaction issue

Post by arivu »

Hi,

I have created custom plugin for posting the content in wordpress. Based on content keywords I have allocated the pages for that custom post.

If i added the small content. i did not get any error. while adding the bulk content i am getting memory allocation issue.

The added content contains special characters, html code and text, so i will explode the content using the below code.
$explode_text = explode("|", $content);
$explode_text = preg_split("/\|+/", $content);

I am getting memory allocation error as below.

"Allowed memory size of 268435456 bytes exhausted (tried to allocate 131223 bytes)" in the following line.

any other function(without kill the memory) like the explode.

any solution for this issue?

thanks,
arivu
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Re: Memory alloaction issue

Post by requinix »

Are you reading our replies? I'm not going to spend any more time trying to help you if you aren't reading our replies.
arivu
Forum Newbie
Posts: 4
Joined: Tue Jun 17, 2014 1:45 am

Re: Re: Memory alloaction issue

Post by arivu »

I am reading all reply. Kindly help me
Post Reply