Re: array initilization and memory usage




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.

Not correct about the stack allocation part. There is no way of knowing
where the Bar array (the piece of memory having space for 500
references) is allocated, unless you know the internal operations of
your JVM, but that is not portable information. Most *likely* it is
allocated on the heap as any other object. Typically, only local
primitives and references are allocated on the stack.

Regards,
Daniel Sjöblom

.



Relevant Pages

  • Re: Vista 64 - pci.sys cannot allocate PCI bar above 4 gig area
    ... are you sure your chip's BAR is a 64-bit ... You can try to do the arbitration yourself, using the I/O level PCI ... of course you will need to allocate the physical address range ... One thing to watch out is that some hardware don't like to operate ...
    (microsoft.public.development.device.drivers)
  • Re: pci 0000:01:00.0: BAR 6: no parent found for of device [0xfffe0000-0xffffffff]
    ... The BAR doesn't fit in the parent's window, ... we silently didn't allocate the BARs. ... We shouldn't warn about not being able to allocate ROM BARs. ... if (root!= NULL) ...
    (Linux-Kernel)
  • Re: pci 0000:01:00.0: BAR 6: no parent found for of device [0xfffe0000-0xffffffff]
    ... The BAR doesn't fit in the parent's window, ... Before my patch, we silently didn't allocate the BARs. ... and fix it by disabling the ROM BAR. ...
    (Linux-Kernel)
  • Re: array initilization and memory usage
    ... > bars[i] = new Barwill allocate a Bar so you'll end with an array of 400 ... allocates 500 references on the stack - no big space requirement ... ... but each new Barwill allocate a Bar object on the heap and the space requirement for a Bar instance. ...
    (comp.lang.java.help)
  • Re: Huge pages and small pages. . .
    ... >> what looks like contiguous memory and away you go. ... you need to have them cached in the TLB; if the TLB runs out of ... > low end of the heap, until someone figures out a way to tell the system ... When you allocate memory, the kernel just marks a promised ...
    (Linux-Kernel)