Dan Sugalski wrote:

At 8:58 PM +0100 11/6/02, Leopold Toetsch wrote:

If we want this, then lets have Parrot_{re,}allocate{,zeroed}.
The allocate_string variants are ok with unzeroed mem already.

Which was my thought here. Things that care can ask for zeroed memory, which they may get anyway. (Or we may keep a big pool of zeroed memory around as it's cheaper to clean large blocks or something)
This patch implements the first step of mem alloc cleanup:

- NEW mem_sys_allocate_zeroed (calloc)
- mem_sys_allocate uses malloc now
- NEW Parrot_allocate_zeroed
- Parrot_allocate uses malloc in res_lea now

implying the following rules:

Buffer headers and such are guaranteed to be zeroed.
Mem allocated via Parrot_allocate may or may not be zeroed, depending on allocator scheme.
The _allocate_string variants do never guarantee to deliver zeroed memory.

Next step is going through files and look, where allocating zeroed memory looks cheaper and use mem_sys_allocate_zeroed.

leo



Reply via email to