To clarify: you're not actually passing a reference over the wire, rather you're copying the entire contents of the array over to the client side. And this data must be serialized before it can be transferred, hence the extra 8mb on the server. Right?
What it may be doing is caching that serialized data in case another client asks for it. This would explain why it is time interval-dependant. Is it possible to obtain a reference to the serialized copy? If so then you could manually undef() it with a call from the client side after it has been received.
On another point, are you sure it's best to transfer the entire array? 8mb is quite a lot to pass by value unless you absolutely have to have it. What about wrapping the array in a class instance and returning a reference that the client could query for more specific entries? This will naturally involve greater frequency of network traffic, but depending on your needs it could be more efficient.
|