Re: amount of memory allocated to a pointer
- From: "André Gillibert" <tabkanDELETETHISnaz@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Sep 2007 12:18:58 +0200
pratap wrote about getting the size of an allocated memory block:
one more way is using _msize(p)
this is even more easier than remembering! !-)
1) This is neither standard nor portable.
2) On implementations where this is available, it works with malloc'ed blocks ONLY.
3) Even on these implementations, it DOESN'T work. It tends to give sizes larger than the allocated size; Giving the effective size of allocation (counting alignments), and not the requested size.
4) It transforms C in BASIC.
With typical C functions accepting a pointer memory block as parameter as well as some size information, you can pass memory you've allocated from anywhere, you can write your own memory pool or sub-heap of malloc's heap, you can manually cut your memory blocks in pieces. Programmers are very used to have the freedom of memory use.
Using _msize is removing this freedom.
Lazyiness has many disadvantages.
--
You can contact me at <tabkanDELETETHISnaz@xxxxxxxxxxxxxxxxxx>
.
- References:
- amount of memory allocated to a pointer
- From: pratap
- Re: amount of memory allocated to a pointer
- From: Mark Bluemel
- Re: amount of memory allocated to a pointer
- From: Richard Heathfield
- Re: amount of memory allocated to a pointer
- From: pratap
- amount of memory allocated to a pointer
- Prev by Date: Re: How to use read() system call to read an 32bit integer
- Next by Date: Re: amount of memory allocated to a pointer
- Previous by thread: Re: amount of memory allocated to a pointer
- Next by thread: Re: amount of memory allocated to a pointer
- Index(es):
Relevant Pages
|