Hi Pieter,
Thanks for the quick response.

Alan

-----Original Message-----
From: [email protected]
[mailto:[email protected]] 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 <[email protected]>
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
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
[email protected]
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
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to