Re: problem encoding large float* matrix

2009-12-01 Thread James Maxwell
Okay, I got everything working using the NSData objects. I'll try encoding the bytes again with the unint8_t* cast. I don't know why I didn't try that... I'm really not very comfortable when it gets down to this low-level stuff. I'm a musician, and my programming experience came from MaxMSP, to

Re: problem encoding large float* matrix

2009-12-01 Thread Jens Alfke
On Dec 1, 2009, at 12:03 PM, James Maxwell wrote: erm... actually, just using: [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"]; fails with a complaint about getting a float* when it expects a uint8_t const. In fact, I know remember that's why I used the NSData

Re: problem encoding large float* matrix

2009-12-01 Thread Greg Guerin
James Maxwell wrote: erm... actually, just using: [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"]; fails with a complaint about getting a float* when it expects a uint8_t const. In fact, I know remember that's why I used the NSData in the first place... any th

Re: problem encoding large float* matrix

2009-12-01 Thread Quincey Morris
On Dec 1, 2009, at 12:03, James Maxwell wrote: > [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"]; > > fails with a complaint about getting a float* when it expects a uint8_t > const. > In fact, I know remember that's why I used the NSData in the first place... > any

Re: problem encoding large float* matrix

2009-12-01 Thread James Maxwell
> > As far as the NSData goes, I'm glad you pointed the redundancy of it out. > I'll just encode the bytes themselves. > erm... actually, just using: [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"]; fails with a complaint about getting a float* when it expects a ui

Re: problem encoding large float* matrix

2009-12-01 Thread James Maxwell
Wow! I'd forgotten how helpful this list is - and how quickly! Everyone pointing out my use of &coincidences is obviously right. I figured it out soon after getting my first reply. I already made an @property accessor for coincidences, so I just used that and the crashes went away. As far as t

Re: problem encoding large float* matrix

2009-12-01 Thread Sherm Pendley
On Tue, Dec 1, 2009 at 1:47 PM, James Maxwell wrote: > I'm trying to save the state of my app. It chews up a lot of memory, most of > which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error in > -encodeBytes:length:forKey: and I'm just wondering what might be happening. > The flo

Re: problem encoding large float* matrix

2009-12-01 Thread Greg Guerin
James Maxwell wrote: NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float); NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences length:coincsSize]; [aCoder encodeBytes:[coincData bytes] length:coincsSize forKey:@"coincidences"]; It makes no sense to go through an NSData o

Re: problem encoding large float* matrix

2009-12-01 Thread Quincey Morris
On Dec 1, 2009, at 10:47, James Maxwell wrote: > I'm trying to save the state of my app. It chews up a lot of memory, most of > which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error in > -encodeBytes:length:forKey: and I'm just wondering what might be happening. > The float* "c

Re: problem encoding large float* matrix

2009-12-01 Thread Nick Zitzmann
On Dec 1, 2009, at 11:47 AM, James Maxwell wrote: > NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float); > NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences > length:coincsSize]; > [aCoder encodeBytes:[coincData bytes] length:coincsSize > forKey:@"coincidences"]; > > The

problem encoding large float* matrix

2009-12-01 Thread James Maxwell
I'm trying to save the state of my app. It chews up a lot of memory, most of which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error in -encodeBytes:length:forKey: and I'm just wondering what might be happening. The float* "coincidences" is a malloced array. NSUInteger coincsSize