[zeromq-dev] Added ResolveEndPoint to ZMQ
Sean McKay
sean at on-track-solutions.com
Thu Jun 25 06:50:28 CEST 2009
I have observed a memory leak - with the ResolveEndPoint function, and
haven't figured out how to free up the data, as calling zmq_free raises a
heabdb assertion error (e.g. if the commented out try block is uncommented).
How should I free up the memory that I am retrieving?
public string ResolveEndPoint(string hostname)
{
byte[] data;
IntPtr locationPtr;
ulong locationSize;
// char[] data2 = new char[256];
//string data2 = "";
zmq_resolve_endpoint(this.transport, hostname, out locationPtr, out
locationSize); // out locationPtr, out locationSize);
data = new byte[locationSize];
Marshal.Copy(locationPtr,data,0,data.Length);
//try
//{
// zmq_free(locationPtr);
//}
//catch(Exception ex)
//{
// Debug.WriteLine(ex.ToString());
//}
return Encoding.ASCII.GetString(data);
}
Thanks,
Sean
From: Sean McKay [mailto:sean at on-track-solutions.com]
Sent: Wednesday, June 24, 2009 10:24 AM
To: 'zeromq-dev at mail.imatix.com'
Subject: Added ResolveEndPoint to ZMQ
I'm not sure you'll want to apply these patches to the system, but I believe
having the ability to call ResolveEndPoint is a useful feature for a client.
In particular, some changes I should note:
I added a function in locator.cpp called resolve_endpoint_safe, which
doesn't use the asserts - rather if it runs into a reply that wasn't OK, it
sets the location variable to "UNKNOWN". I do not code C++ for my day job
(and prefer not to! ;-), so please, if anyone has improvements or
reliability changes, feel free to make them.
Thanks,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090624/9ac579f2/attachment.htm>
More information about the zeromq-dev
mailing list