Mail Archives: cygwin/2002/09/03/01:28:21
------=_NextPart_000_005E_01C2533C.F4A3BDB0
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: 7bit
Hi!
I'm use gethostbyaddr() for name resolving. But when I'm call
gethostbyaddr() many times, the memory, allocated by the program is growing
(see attach). Why?
--
Best regards, Serge P. Voronin
St.Ingineer of NDT, JSC "Tekhdiagnostika", Orenburg, Russia
tel. +7-(3532)-631166, fax. +7-(3532)-629441
mailto:buddie AT rambler DOT ru
------=_NextPart_000_005E_01C2533C.F4A3BDB0
Content-Type: application/octet-stream;
name="testgethostbyaddr.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="testgethostbyaddr.c"
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#define COUNT 100000
int main(void)
{
int i;
struct in_addr addr;
struct hostent *hp;
addr.s_addr = htonl(INADDR_LOOPBACK);
for (i = 0; i < COUNT; i++)
{
hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
if (hp)
printf("%d: %s = %s\n", i, inet_ntoa(addr), hp->h_name);
else
printf("%d: Resolving failed\n", i);
}
return 0;
}
------=_NextPart_000_005E_01C2533C.F4A3BDB0
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
------=_NextPart_000_005E_01C2533C.F4A3BDB0--
- Raw text -