Possible duplicate:C-programming: how to find out how much for free?
In this fragment
void main() { void *p = malloc(300); printf("%d",sizeof(*p)); free(p); }
How to freely know a lot of memory, is it supposed to be released from the void pointer?
I believe that if there is an internal table / function, it should be available to find out the sizes of any objects, while the output printfis1
printf
1
malloc and free do their own hidden accounting so that they can do the right thing.
, sizeof() , , sizeof() , malloc/free .
. comp.lang.c ยท 7.26
. , , , .. sizeof(void), .
sizeof(void)
malloc , . free malloc , , .
malloc
free
Wiki
Source: https://habr.com/ru/post/1777962/More articles:Solving an ambiguous grammar without resorting to GLR-Parser - cAre filters or phase shifters a good security tool in Java EE 6? - java-eewhat is the point of hiding data - c #How to check if the screen saver works? - linuxIs Windows Boost portable to other Windows systems? - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1777963/how-can-i-diff-two-trees-to-determine-parental-changes&usg=ALkJrhiikcvzkn5BJJJgoVUzb5IePBZTGwHow to set cobertura data file location when using cobertura maven plugin? - mavenUpdating / Pasting Existing Objects in NSFetchedResultsController - objective-cTrying to get your friends list from Twitter using httparty (ruby) - ruby โโ| fooobar.comNSFetchedResultsController with data not updating - iosAll Articles