PDA

View Full Version : maximum size of data than can be sent to vvOut_Json



Hugo A. Cantor
04-30-2010, 08:23 AM
Hello,
What is the maximum size of data you can send to vvOut_Json? I might be misreading the code, but I see that the constant MAXALLOCATION, which is used as a limit for memory allocation in WriteJSON and is used to trigger an error message in vvOut_Json, is set to 50MB. However in WriteJSON the %realloc RPG BIF is used. %alloc and %realloc can only allocate up to a little over 16MB.

-thanks,

sean.lanktree
04-30-2010, 09:29 AM
vvOut only allocates memory of 1MB at a time as needed, thus never exceeding the maximum allocation size limit per call of %realloc. So to answer your question, it will allocate up to 50MB....however, that would be an overwhelmingly large response.

richard.milone
04-30-2010, 09:39 AM
Typically you don't want to make a large response with vvOut_toJson like that. For example, if you're loading a grid with JSON data our testing shows that you shouldn't display more than 500 records at a time. More than that would take too long to transfer and too long for the browser to render. So for record sets that will always be less than 500 records we can use load-all method, but for larger you would use page-at-a-time. Thus any individual JSON response would be small and perform well for the user.

We might be able to give you better advice if you let us know what you're trying to do with such a large response.