× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Rory,

I don't see any reliable way for you to access and use the allocation size.

I suspect in one case what you really want is the size initally requested for an explicit allocation -- but there are many cases where the size requested is not necessarily equal to the size actually allocated by the system. An allocation request of 10 bytes where say 64 bytes was actually allocated wouldn't buy you much if you wanted a value of 10 returned. And this is assuming the very restricted scenario where storage was explicitly allocated by the calling program and you're being passed the initial byte of the allocation.

In a possible second case (and probably the most desireable) -- dynamically determining the "size" of an arbitrary variable (most likely implicitly allocated storage by the high level language support) passed as a parameter to an application program -- it makes my head swim just thinking about what all difficulties (and guesses) would be involved. As the system generally doesn't like to provide an interface where the result is based on guesses I doubt that such an API would be made available without a whole lot of infrastructure work (and even then a long list of what's not going to work as you might expect) being done up front.

Bruce


Rory Hewitt <roryhewitt@xxxxxxxxx> wrote:
Bruce,

So is there any chance that we could get access to the allocation size?

Rory
On Thu, Jun 19, 2008 at 3:42 PM, Bruce Vining
wrote:

The system keeps track of storage allocations based on the address of the
initial byte allocated and the amount of storage allocated. So when you
dealloc passing the address of the initial byte, the system can easily
lookup the amount of storage that was allocated (and deallocate it). If you
pass in a pointer value addressing the middle of an allocation you'll simply
get an error.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.