Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Does malloc add size information to program?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Thomas Matthews, post: 1688001"] As a reminder to the OP, malloc is allowed to allocate more memory than you requested. For example, if you requested 10 bytes, but memory is apportioned into 16-byte chunks, malloc can allocate 16 bytes (one chunk). The only trusted information you can get from malloc is whether it succeeded or not. You cannot be certain that it allocate exactly the amount requested. You cannot guarantee that the same program executed the same way will return the same pointer (address) by malloc. If malloc succeeds, you can safely say that you have an area of at least the amount of space you requested. -- Thomas Matthews C++ newsgroup welcome message: [URL]http://www.slack.net/~shiva/welcome.txt[/URL] C++ Faq: [URL]http://www.parashift.com/c++-faq-lite[/URL] C Faq: [URL]http://www.eskimo.com/~scs/c-faq/top.html[/URL] alt.comp.lang.learn.c-c++ faq: [URL]http://www.raos.demon.uk/acllc-c++/faq.html[/URL] Other sites: [URL]http://www.josuttis.com[/URL] -- C++ STL Library book [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Does malloc add size information to program?
Top