Re: array initilization and memory usage
- From: Mark Space <markspace@xxxxxxxxxxxxx>
- Date: Mon, 26 Jun 2006 22:07:16 GMT
Frank van Schie wrote:
ge0rge wrote: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.
Probably a typo. The 4 and the 5 key are right next to each other.
Don't forget that a reference is NOT free. I think we already figured out here on this list that most JVMs implement a reference as 8 bytes. So Bar bar[500]; with no objects at all is still 4008 bytes for most JVMs.
My suggestion: use a collection.
.
- 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
- Re: array initilization and memory usage
- From: Frank van Schie
- array initilization and memory usage
- Prev by Date: unexpected token in groovy
- Next by Date: Anyone ever built Tomcat 5.5 from source?
- Previous by thread: Re: array initilization and memory usage
- Next by thread: Re: array initilization and memory usage
- Index(es):
Relevant Pages
|