• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Strange leak reported by leaks command line tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange leak reported by leaks command line tool


  • Subject: Strange leak reported by leaks command line tool
  • From: Aarno Syvänen <email@hidden>
  • Date: Mon, 16 Jun 2008 12:08:54 +0200

Hi,

here is the code (omitting error checks):

- (int)udpRecvfrom:(int)s datagram:(NSString **)datagram addr:(NSData **)addr
{
...
bytes = recvfrom(s, buf, UDP_PACKET_MAX_SIZE, 0, (struct sockaddr *) &sa, &salen);
...
addr_s = malloc(salen + 1);
memcpy(addr_s, (char *) &sa, salen);
//addr_s[salen] = '\0';
*addr = [NSData dataWithBytes:addr_s length:bytes];
...
return bytes;
}


- (int)readBuffer
{
...
ret = [s udpRecvfrom:[c getFd] datagram:&dgram addr:&cliaddr];
//blist_debug_misc(@"GNISIPConn: readBuffer", @"we have a dgram %@", dgram ? dgram : @"nil");
if (dgram && ret > 0) {
[inbuffer appendString:dgram];
// blist_debug_misc(@"SIPCONN: readBuffer", @"[%@:%ld %d:%d:%d] (from the pool): read %d bytes from"
// @" <%@:%d> (%ld channels)", host, port, [c getPort], i, [c getFd], ret,
// [s udpGetIp:cliaddr], [s udpGetPort:cliaddr], len);
// [dgram release]; dgram = nil;
// [cliaddr release]; cliaddr = nil;
return 0;
}
...
}


Leaks reports following call stack:
Call stack: [thread 0xb037b000]: | thread_start | _pthread_start |
__NSThread__main__ | -[NSThread main] | -[sipbridge response_thread:] |
-[GNISIPState handleResponse:start_closing:status:conn:] |
-[GNISIPEvent waitSip:conn:] | -[GNISIPConn readSip:status:headers:body:] |
-[GNISIPConn readStartLine:status:] | -[GNISIPConn readLine:] |
-[GNISIPConn readBuffer] | -[GNISocket udpRecvfrom:datagram:addr:] |
+[NSData(NSData) dataWithBytes:length:] | -[NSData(NSData) initWithBytes:
length:] | -[NSConcreteData initWithBytes:length:copy:freeWhenDone:
bytesAreVM:] | NSAllocateObject | _internal_class_createInstanceFromZone |
malloc_zone_calloc


and 512 bytes of binary data

Aarno


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Strange leak reported by leaks command line tool
      • From: Jens Alfke <email@hidden>
    • Re: Strange leak reported by leaks command line tool
      • From: "Igor Mozolevsky" <email@hidden>
  • Prev by Date: Printing thearguments of obj-c function in DTrace/Instruments (was NSNotifications & background apps?)
  • Next by Date: Re: Strange leak reported by leaks command line tool
  • Previous by thread: Printing thearguments of obj-c function in DTrace/Instruments (was NSNotifications & background apps?)
  • Next by thread: Re: Strange leak reported by leaks command line tool
  • Index(es):
    • Date
    • Thread