views:

127

answers:

3

Hello all,

I think the answer to this question is no but I do not have anymore leads of the problem I am trying to figure out.

I initially had a single script that did some database queries via SQLCMD. I have now decided to initiate this script via AJAX and wait for the response. But I get a fatal error of:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 445 bytes) in C:\process_txt.php on line 109

The only new thing that I have changed in my script is this ajax request and nothing else to be honest which is why I have asked this question.

I use JQuery AJAX request and I don't think I am using polling. Here is an example AJAX GET request that I make use of:

function process_txt(checkbox){

            waiting = 1;

            var folder_path = $('#folder_path').val();

            var file_name = $('#'+ checkbox + '_val').val();

            $.get("process_txt.php", { path:  folder_path, file: file_name},

            function(data){

                           alert(data);             

            });

}

Thanks to anyone that can try to shed some light on this matter and not the problem I am having, just this question! :)

+12  A: 

AJAX vs a regular call will make no difference to the server. As far as PHP is concerned, nothing will have changed - the request is just a request, regardless of how it was initiated from the client.

I'd look for the source of your memory leak elsewhere - perhaps the processor can get in an infinite loop if certain parameters are specified?

jvenema
+1  A: 

In the context of PHP memory: Using AJAX is the same as not using AJAX, but as a result of using AJAX you can output less data back to the user in the HTTP response, which makes PHP to use less memory.

Dor
A: 

No. The requests from JS and browser's address bar are the same. Oh wait, JSON/XML is less bytes than HTML! So it's better.

Look at your PHP code - maybe there's some bugs in database queries.

myfreeweb