[haiku-development] Re: create_area vs. resize_area

  • From: julun <host.haiku@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 26 Aug 2008 23:42:42 +0200

Ingo Weinhold schrieb:
On 2008-08-26 at 14:27:02 [+0200], julun <host.haiku@xxxxxx> wrote:
i wonder what's more expensive, create_area or resize_area? Is there
any difference at all?

create_area() creates a new set of kernel structures to manage an area (vm_area and VM*Cache), which isn't really spectacular, though. That aside neither call does very much for B_NO_LOCK areas. The actual work (page allocation and mapping) happens later, when the new pages of the area are touched. It's also worth considering that resize_area() will fail, if the address space range following the area is not free.

If you're allocating potentially much new memory in relatively small increments, it is probably better to try resizing first, or you'll end up with lots of small areas.


Great, thank you! :)
Karsten

Other related posts: