Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 16th, 2012  |  syntax: None  |  size: 0.79 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. > *** error: can't allocate region
  2. > *** set a breakpoint in malloc_error_break to debug Assertion failed: (msg_->flags | ZMQ_MSG_MASK) == 0xff (zmq.cpp:211)
  3. > Python(42410,0xaccb8a28) malloc: *** mmap(size=3559424) failed (error
  4. > code=12)
  5.        
  6. import sys
  7. import resource
  8. import zmq
  9. import time
  10.  
  11. context = zmq.Context()
  12.  
  13.  
  14. if sys.argv[1] == 'worker':
  15.     # Socket to send messages to
  16.  
  17.     sender = context.socket(zmq.PUSH)
  18.     sender.connect("tcp://localhost:5558")
  19.  
  20.     while True:
  21.         msg = 'x' * 3559333
  22.         time.sleep(.01)
  23.         sender.send(msg)
  24. else:
  25.     # Socket to receive messages on
  26.  
  27.     receiver = context.socket(zmq.PULL)
  28.     receiver.bind("tcp://*:5558")
  29.     while True:
  30.         msg = receiver.recv()
  31.  
  32.         print msg[0:5], len(msg), resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
clone this paste RAW Paste Data