By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,101 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

dynamic memory allocation

P: n/a
New
I am new to java and was wondering does java have dynamic memory allocation
like in C (malloc, calloc)

Thank you
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Liz
yes, it is called "new"

"New" <a@a.co> wrote in message news:40**********@news.iprimus.com.au...
I am new to java and was wondering does java have dynamic memory allocation like in C (malloc, calloc)

Thank you

Jul 17 '05 #2

P: n/a
New wrote:
I am new to java and was wondering does java have dynamic memory allocation
like in C (malloc, calloc)


Yes and no. As in, yes, Java does dynamic memory allocation and no, it
is not like C.

The main difference is that memory allocated in C with malloc() and
friends must be freed or memory leaks will result. Java has automatic
garbage collection, making it much more difficult to create memory leaks.

Consult your favorite Java text on the new operator.

Ray
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.