On Thu, 23 Apr 2015 09:52:56 +0800, 慕冬亮 said:
I'm looking for that whether the object allocated by malloc is the multiple of certain bytes! Or how does the malloc allocate dynamic memory ?? I does an experiment in my computer!
1) malloc() is a userspace function, not kernel. 2) There are multiple malloc() implementations out there - the one you're using is *probably* glibc's, but there are others (including debugging memory allocators that return strictly the number of bytes allocated, with canaries on either end to trap misuse of memory).
But the result has no feature about a ,b ,c!
What do you mean by "no feature", and what were you expecting? When I run it, I get: % ./a.out a = f35010 b = f35040 c = f35070 which tells me that malloc() returned 3 pointers that are 48 bytes apart (which is *not* the same thing as "there are 48 bytes safe to use").