|
|
Is Objective-C Managed?
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2003
Status:
Offline
|
|
From what I understand, Objective-C is an extension of C, so I don't see how it could be "managed", but I have seen postings in newsgroups which refer to ObjC as the first managed language. So is there some managed-esque features of the language, or are the people in newsgroups smoking crack, as usual?
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
What exactly do you mean by "managed"?
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2003
Status:
Offline
|
|
Originally posted by Angus_D:
What exactly do you mean by "managed"?
Managed as in doesn't have direct access to memory. Examples include Java, C#, managed C++, vb.net.
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by TampaDeveloper:
Managed as in doesn't have direct access to memory. Examples include Java, C#, managed C++, vb.net.
Since Objective C is a derivitave of C, all C code is syntactically correct in ObjC. Therefore, you have full access to memory if you want it.
It's worth mentioning that you don't generally call malloc and free in ObjC. You send objects retain and release messages instead.
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2003
Status:
Offline
|
|
Originally posted by Arkham_c:
Since Objective C is a derivitave of C, all C code is syntactically correct in ObjC. Therefore, you have full access to memory if you want it.
It's worth mentioning that you don't generally call malloc and free in ObjC. You send objects retain and release messages instead.
This probably answers my question. While not a managed language, per-se, ObjC protects one from buffer overruns, etc by following the design pattern you mention. Hmm, this seems like a good solution.
ObjC is officially the next language I'm going to learn.
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
Originally posted by TampaDeveloper:
This probably answers my question. While not a managed language, per-se, ObjC protects one from buffer overruns, etc by following the design pattern you mention. Hmm, this seems like a good solution.
ObjC is officially the next language I'm going to learn.
Good plan. It's really fun
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by TampaDeveloper:
This probably answers my question. While not a managed language, per-se, ObjC protects one from buffer overruns, etc by following the design pattern you mention. Hmm, this seems like a good solution.
What you really mean is "does Objective-C have garbage collection" in which case the answer is no. Retain/release doesn't prevent you from buffer overruns, memory leaks, bad pointers or anything like that, it's just a structured method for memory management. You still have to do the memory management yourself.
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Aug 2002
Location: Atlanta, GA, USA
Status:
Offline
|
|
I think he's asking if Obj-C runs "in a box" like java or .net managed code that will govern resource access. It doesn't though, obj-c programs run in their own process space and have full access to system memory.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2003
Status:
Offline
|
|
Originally posted by flanders:
I think he's asking if Obj-C runs "in a box" like java or .net managed code that will govern resource access. It doesn't though, obj-c programs run in their own process space and have full access to system memory.
Thank you. This is what I was asking. Do you know of any good tools for identifying buffer-overruns, memory leaks, etc?
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
Originally posted by TampaDeveloper:
Thank you. This is what I was asking. Do you know of any good tools for identifying buffer-overruns, memory leaks, etc?
OmniObjectMeter is supposedly quite good for identifying leaks (omnigroup.com). I can't afford it, but I've had very good experiences with their other software.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by flanders:
I think he's asking if Obj-C runs "in a box" like java or .net managed code that will govern resource access. It doesn't though, obj-c programs run in their own process space and have full access to system memory.
Obj-C programs don't have "full access to system memory" because OS X has protected memory and separate address spaces for each process. The same applies to Java. Not really sure what you mean here... :???:
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Originally posted by Angus_D:
Obj-C programs don't have "full access to system memory" because OS X has protected memory and separate address spaces for each process. The same applies to Java. Not really sure what you mean here... :???:
I think he means the ability to directly access memory -- e.g. with malloc() -- rather than relying on a runtime to do it for you.
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
Note: Obj-C does not protect you from buffer-overruns, but most of the Cocoa classes do. If you are using Cocoa network listeners, you are immune on that channel (unless you create the problem yourself in C), NSStrings are immune, etc...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|