tags:

views:

61

answers:

4

Hi

I am having a problem passing JSON from PHP server and ASP.NET server. I am getting Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 48 bytes)

I am looking for a way to compress the JSON.

Thanks

A: 

Why not increase your memory size in your PHP.ini file?

Luca Matteis
67MB is too much. The JSON I need may increase up to 200MB
oshafran
A: 

.NET has built in compression classes. Such as the DeflateStream or GzipStream classes located in the System.IO.Compression namespace. They should do the trick.

berblexer
+1  A: 

Compressing the JSON will probably not change anything, since you'll need the uncompressed JSON before you can compress it (ie. you'll end up using even more memory then you are using currently).

wimvds
So what are my alternatives for sending a huge chunk of text between servers?
oshafran
That depends on what you're trying to achieve. I see you mention that it can be up to 200 Mb, so I guess you're not transferring data to be used on an interactive webpage (if you are however : that's insane).
wimvds
A: 

Flush the output buffers regularly, so you don't need to have more than a few KB to produce your many MB stream.

Jon Hanna