Re: array initilization and memory usage
- From: Frank van Schie <frankNOSPAM@xxxxxxxx>
- Date: Mon, 26 Jun 2006 19:50:14 +0200
ge0rge wrote:
> I don't think so. new Bar[500] will alocate an array of references. Each
> bars[i] = new Bar() will allocate a Bar so you'll end with an array of 400
> references and 5 Bar allocated.
>
Incorrect.
Bar bar[500]; allocates 500 references on the stack - no big space requirement ... but each new Bar() will allocate a Bar object on the heap and the space requirement for a Bar instance.
That's... what he said, barring syntax errors. Except he doesn't know the difference between 400 and 500.
--
Frank
.
- Follow-Ups:
- Re: array initilization and memory usage
- From: Mark Space
- Re: array initilization and memory usage
- References:
- array initilization and memory usage
- From: jon23d
- Re: array initilization and memory usage
- From: Xavier Tarrago
- Re: array initilization and memory usage
- From: ge0rge
- array initilization and memory usage
- Prev by Date: exception in native code
- Next by Date: unexpected token in groovy
- Previous by thread: Re: array initilization and memory usage
- Next by thread: Re: array initilization and memory usage
- Index(es):
Relevant Pages
|