Re: my arrays are being deallocated, and i dky
Re: my arrays are being deallocated, and i dky
- Subject: Re: my arrays are being deallocated, and i dky
- From: myah payne <email@hidden>
- Date: Sat, 17 Jul 2004 17:40:02 -0500
On Jul 17, 2004, at 5:26 PM, Shawn Erickson wrote:
On Jul 17, 2004, at 3:07 PM, myah payne wrote:
I have a class that is in obj-c++ and several structs predefined.
The main one is called MODEL. It consists of f pointers for each of
the other kind of structs. and an int to keep track of how long the
array of other sturcts is. Basically I say:
faces = new Face[numberOfFaces];
now this setup worked before when i was dealing with just one MODEL;
but now i want to put my MODELS into a NSNutableArray. So I am using
NSData to wrap the MODEL data and storing the NSData Object. When
the MODEL is needed later, the model's values are correct in that
pointers still have the same address. But the data that they were
pointing is long gone. I'm not sure why this is happening when
before they worked. IVe only changed the interface to the data, not
the data code itself.
Who calls the C++ style delete on the array of Faces that you create?
NSData cannot prevent your original delete operations from taking
place. Since you are using C++ you may just want to use a provided std
library collection for this.
As an asde maybe anyone knows a nice cocoa way to store some 8k
floats without too much over head.
Use a standard C array with enough space for the floats...? could even
carve that out the buffer in an NSData object. Not clear on what type
of over head you are talking about... storage, searching, access, etc.
-Shawn
There is no delete call ;-) I know its bad style but for now I am
not concerned about freeing the memory, since the arrays will be used
throughout the life of the program. I with making an array with enough
space is I don't howe to make varying size arrays. The number of
vertices might be only 25 or might go up to 1500, with each vertex
having 10 floats associated with it. The size of the array will not
change once it is initialized, I just would like to know how to say
init with length x or init with length y; if a C version would be
better.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.