[zeromq-dev] Maximum message size on Windows
Merijn Verstraaten
merijn at inconsistent.nl
Wed Aug 21 14:47:13 CEST 2013
Well, considering the wire protocol is limited to long sizes of 64bit unsigned, I guess it would be appropriate to consider 2^64 - 1 bytes the maximum message size. Which is almost the same as "no limit" given current hardware circumstances, I guess.
Cheers,
Merijn
On Aug 21, 2013, at 12:05 , Alan Ward wrote:
> Hi Pieter,
> Thanks for the quick response.
>
> Alan
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org
> [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
> Sent: 21 August 2013 11:52
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] Maximum message size on Windows
>
> There is no maximum defined message size. What you are seeing is the default
> stack size of 1MB being hit by your use of a huge local variable.
>
> In general do not put anything larger than a few kilobytes into local
> storage since depending on the build, the stack can be as small as 4KB. You
> don't get any warning, just a nasty crash.
>
> Use dynamic allocation, and it will work up to the limit of heap memory.
>
> -Pieter
>
> On Wed, Aug 21, 2013 at 12:43 PM, Alan Ward <alan.ward at btinternet.com>
> wrote:
>> Hi,
>> I have an application that I have been developing on Linux (Ubuntu)
>> for a few months.
>> I am now trying to port it to Windows.
>>
>> After battling with Visual Studio for a while I now have the code
>> executing, but have immediately hit a problem with the maximum message
> size.
>>
>> On Linux I have a maximum message size of 1Mb (1048576). This is
>> fairly arbitrary so I can reduce it.
>> On Windows this causes zmq_recv to crash. I have found that the
>> threshold is around 1027830.
>>
>> I am using the 32-bit version of zeromq (3.2.3) on Windows and 64-bit
>> (3.2.2) on Linux.
>>
>> The following code snippet causes an exception on my system.
>>
>> #include <zmq.h>
>> #include <stdio.h>
>> #include <tchar.h>
>> #include <string.h>
>> #include <assert.h>
>>
>> int _tmain(int argc, _TCHAR* argv[])
>> {
>> int rc;
>> char buffer [ 1027830 ];
>> void *context;
>> void *responder;
>> size_t msg_size;
>>
>> puts("start");
>> context = zmq_ctx_new ();
>> responder = zmq_socket (context, ZMQ_REP);
>> rc = zmq_bind (responder, "tcp://*:5555");
>> if ( rc != 0 ) { printf("zmq_bind error: rc:%d:errno:%d\n", rc,
>> errno); return 1; }
>>
>> msg_size = zmq_recv (responder, buffer, 2048, 0);
>>
>> return 0;
>> }
>>
>> Is there a defined maximum size? I did search for some information on
>> this a while ago, but found nothing.
>>
>> Regards,
>> Alan
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.3392 / Virus Database: 3211/6594 - Release Date: 08/20/13
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130821/c19db2cc/attachment.sig>
More information about the zeromq-dev
mailing list