I am using GCDAcyncUDPSocket to receive data. In the below code, I am creating a tuple of (timestamp, data) and adding it into another array. Here is my code:
- (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data fromAddress:(NSData *)address withFilterContext:(id)filterContext
{
dispatch_queue_t bg_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
NSString *msg = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSTimeInterval t = [self getTime];
if (msg)
{
[self.activityQueue.activityQueue enqueue:@"1"];
dispatch_async(bg_queue, ^{
NSData * d = [data copy];
[self addRecvJitter:t withData:d];
d= nil;
});
}
}
- (void)addRecvJitter:(NSTimeInterval)t withData:(NSData *)data
{
NSString * add = [NSString stringWithFormat:@"%f",( t - self.jitterOrigin)];
NSArray * addToList = [[NSArray alloc] initWithObjects:add,data, nil];
[_rcvdJitter addObject:addToList];
}
I get the following error malloc: * error for object 0x7a9c2820: double free * set a breakpoint in malloc_error_break to debug at this line"[_rcvdJitter addObject:addToList];"
Can I get some help regarding this?
Thanks