memory management question

0 views
Skip to first unread message

Eumir Gaspar

unread,
Feb 10, 2010, 5:12:44 PM2/10/10
to cocoahea...@googlegroups.com
This is pretty much a dumb question, but I just want to be sure im not doing it wrong. In doing assignment 2a, we're supposed to make a mutable array and add polygons in that array. I did this successfully and also called release on the array. I don't see any log messages from my custom dealloc for the polygon so the question is: before releasing the array, should i iterate on all the objexts and release them one by one? or does releasing the array entail releasing of the objects inside it? (if it's the latter's case, then i must be wrong using my dealloc...which is weird since calling it on the object shows the log). Thanks!

--
Eumir Gaspar
Web Developer
http://admoolabs.com

Radamanthus Batnag

unread,
Feb 10, 2010, 7:34:16 PM2/10/10
to cocoahea...@googlegroups.com
On my solution I:
1. instantiate the polygon object using alloc-init combo
2. add the object to the array using addObject
3. call autorelease on the object I instantiated in #1
4. just call release on the array. No need to iterate on the array contents.

The polygon dealloc gets called.

paul_sns

unread,
Feb 10, 2010, 8:31:17 PM2/10/10
to cocoaheads-manila
If I'm not mistaken, the array calls retain on the objects it
contains. That means you need to release the polygon objects
immediately after adding them to the array.

ruben d canlas jr

unread,
Feb 11, 2010, 2:01:25 AM2/11/10
to cocoahea...@googlegroups.com
i'm sure all of us would agree there are no dumb questions in this mailing list. 

like this one i'm about to ask -- where do i get copies of the assignments? i can't seem to find them at itunes. :)

tia

RUBEN CANLAS JR.
----------------------------------------------------------------
http://CouchKamote.com
"When your computer wont power up always complain to IT before checking to see if you've switched on the monitor"

Eumir Gaspar

unread,
Feb 11, 2010, 2:07:34 AM2/11/10
to cocoahea...@googlegroups.com
It's in one of the earlier threads. Here's a re-post of the link hehe

paul_sns

unread,
Feb 11, 2010, 2:08:42 AM2/11/10
to cocoaheads-manila
I totally agree with Ruben, that's why we're in this study group in
the first place. :)

Here's a link to the assignment documents: http://www.stanford.edu/class/cs193p/

Cheers,
Paul

On Feb 11, 3:01 pm, ruben d canlas jr <rubencan...@gmail.com> wrote:
> i'm sure all of us would agree there are no dumb questions in this mailing
> list.
>
> like this one i'm about to ask -- where do i get copies of the assignments?
> i can't seem to find them at itunes. :)
>
> tia
>
> RUBEN CANLAS JR.

> ----------------------------------------------------------------http://CouchKamote.com


> "When your computer wont power up always complain to IT before checking to
> see if you've switched on the monitor"
>

ruben d canlas jr

unread,
Feb 11, 2010, 2:32:45 AM2/11/10
to cocoahea...@googlegroups.com
maraming salamat, eumir at paul! :)

i actually joined ADC and downloaded the SDK when it came out, only to find out that my MacBook needed to be upgraded to a Leopard (which I did not like). so now that i've upgraded my Mac, exactong Radam invited me to join. now, wala nang excuse!

RUBEN CANLAS JR.
----------------------------------------------------------------

http://CouchKamote.com
"When your computer wont power up always complain to IT before checking to see if you've switched on the monitor"


paul_sns

unread,
Feb 11, 2010, 3:45:35 AM2/11/10
to cocoaheads-manila
It looks like your Leopard days will be short-lived, iPad SDK requires
us to upgrade to Snow Leopard.
I'm also not very keen with it, but can you argue with Steve? Even
Adobe seems to be having a hard time... :)

On Feb 11, 3:32 pm, ruben d canlas jr <rubencan...@gmail.com> wrote:
> maraming salamat, eumir at paul! :)
>
> i actually joined ADC and downloaded the SDK when it came out, only to find
> out that my MacBook needed to be upgraded to a Leopard (which I did not
> like). so now that i've upgraded my Mac, exactong Radam invited me to join.
> now, wala nang excuse!
>
> RUBEN CANLAS JR.

> ----------------------------------------------------------------http://CouchKamote.com


> "When your computer wont power up always complain to IT before checking to
> see if you've switched on the monitor"
>

Reply all
Reply to author
Forward
0 new messages