[on-rev] LC code output bumping against a server size limit?

Phil Davis revdev at pdslabs.net
Tue Jun 25 14:18:11 EDT 2013


I found a code efficiency that serves as a workaround to the problem for 
now.

Apparently there is a server memory limit per thread, and my code was 
bumping against it when processing a large array. Last night I changed 
my problem code from something like this:

     get arrayEncode(tBigArrayA)
     put base64Encode(it) into it2
     put urlEncode(it2) -- output to requesting app

to something like this:

     put urlEncode(base64Encode(arrayEncode(tBigArrayA)))

and the "internal server error" went away when processing the big array.

So my original statements, in their uncompounded form, were easier for 
humans (at least for me) to comprehend but multiplied the memory 
resources needed for the code to execute successfully under large-data 
conditions. But by putting the functions together in a single compound 
statement, variables were eliminated which decreased resource demand, 
and the server's memory limit became a non-issue (at least for now).

That's what I learned.

Best -
Phil Davis




On 6/24/13 5:50 PM, Phil Davis wrote:
> Hi Folks,
>
> My on-rev LC server code takes data from many files and organizes it 
> into an array. It then arrayEncodes and base64Encodes the array and 
> "puts" it to the requesting app.
>
> Normally the code works as expected, but when the encoded array 
> approaches 8 MB, an internal server error (500) occurs. It seems to 
> happen after the arrayEncode() executes and before (or when) 
> base64Encode() is executed. (The two functions are back-to-back in the 
> code.) Again, this only happens when the encoded array is approaching 
> 8 MB in size.
>
> Is there an Apache setting or maybe a Linux setting that enforces an 8 
> MB limit on thread size or something similar? That seems the most 
> likely suspect of my problem to me. If so, can I increase the limit? 
> Can you tell me how?
>
> Thanks for your time.
>

-- 
Phil Davis





More information about the use-livecode mailing list