e******r 发帖数: 220 | 1 in C, after malloc, for example:
int* a = malloc(8);
we use free (a) to collect memory back at the end of the running of
the program. For this 'free' command, how does the Operating System know
how many bytes should it free for 'a' at that time? Thanks | R********y 发帖数: 288 | 2 runtime takes care of that, not the os
of
【在 e******r 的大作中提到】 : in C, after malloc, for example: : int* a = malloc(8); : we use free (a) to collect memory back at the end of the running of : the program. For this 'free' command, how does the Operating System know : how many bytes should it free for 'a' at that time? Thanks
| r*******y 发帖数: 290 | 3 I head that the length is stored right before the pointer
【在 R********y 的大作中提到】 : runtime takes care of that, not the os : : of
|
|