Re: Proposed addition of malloc_size_np()
- From: Jason Evans <jasone@xxxxxxxxxxx>
- Date: Sat, 25 Mar 2006 11:11:30 -0800
John-Mark Gurney wrote:
Jason Evans wrote this message on Sat, Mar 25, 2006 at 00:23 -0800:
have to store the precise allocation request size; it can instead round the request size up internally, then treat the allocation as being of this rounded up size. By vaguely specifying the return value of malloc_size_np(), we grant the malloc implementation freedom as to whether the size is precisely what was specified during allocation, or some rounded up value.
I had no intention of suggesting that malloc_size_np() should extend existing allocations, nor change the return value depending on the current state of memory following the allocation pointed to by ptr.
Ok, so what you are saying is that the function returns the size of
the bucket (if any) that the memory was allocated from... But even
though this function may return a larger value, the program is not
allowed to use extra space, and it's only useful for further
allocations of the same size?
I'm saying that malloc_size_np() returns the size of the allocation, to the best of the allocator's knowledge. If you malloc(17), and malloc_size_np() returns 32 for that allocation, then you can treat it as a 32-byte allocation. However, the malloc implementation could conceivably return any value >=17.
Jason
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: Proposed addition of malloc_size_np()
- From: Robert Watson
- Re: Proposed addition of malloc_size_np()
- References:
- Proposed addition of malloc_size_np()
- From: Jason Evans
- Re: Proposed addition of malloc_size_np()
- From: Matthew Dillon
- Re: Proposed addition of malloc_size_np()
- From: Jason Evans
- Re: Proposed addition of malloc_size_np()
- From: John-Mark Gurney
- Proposed addition of malloc_size_np()
- Prev by Date: Re: Proposed addition of malloc_size_np()
- Next by Date: Re: Proposed addition of malloc_size_np()
- Previous by thread: Re: Proposed addition of malloc_size_np()
- Next by thread: Re: Proposed addition of malloc_size_np()
- Index(es):
Relevant Pages
- Re: Proposed addition of malloc_size_np()
... By vaguely specifying the return value of ... we grant the malloc implementation
freedom as to ... whether the size is precisely what was specified during allocation, ...
current state of memory following the allocation pointed to by ptr. ... (freebsd-arch) - Re: How to release heap memory that is marked as free
... As I said, fragmentation is a very serious problem, and one of the most serious problems
... my allocator was accused of using massive amounts of memory. ... I'm going to
have to re-think the memory allocation that I'm ... process's 'working set'. ...
(microsoft.public.vc.mfc) - Re: [PATCH 00/28] Swap over NFS -v16
... memory they can consume. ... So we need the extra (skb) ... included
in the reserve? ... if the allocation had to dip into emergency reserves, ...
(Linux-Kernel) - Re: Memory leak with CAsyncSocket::Create
... read my essay on how storage allocators work. ... Create method is consuming
system memory that is not released back to ... The memory consumption is either shown as "Mem
Usage" on the Task ... many levels of allocation going ... (microsoft.public.vc.mfc) - Re: OT: C++ overloading operators
... dynamic allocation, no matter how many "clever tricks" are used... ... though
there's enough memory in the system, ... all these "flexible data types" map into
CPU command ... The computing environment is completely ... (comp.dsp)