Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Freeing

Name: Anonymous 2008-12-29 1:26

Is there any real point in freeing memory these days? And I don't mean freeing memory for things that constantly grow and shrink in size. I mean freeing that one array that you malloc at the beginning of the program and you need it until the end of the program. What is the benefit of freeing it when it will be automatically freed by the operating system?

Name: Anonymous 2008-12-29 15:54

>>11
Explain this then.

b:\>cat  memory.c
#include <stdio.h>
#include <stdlib.h>

main(){
    fwrite(malloc(0x100),1,0x100,stdout);
}
b:\>gcc memory.c -o memory && memory|hexdump -C
00000000  a0 27 93 00 28 0f 93 00  2e 61 70 70 76 65 72 73  |.'..(....appvers|
00000010  69 6f 6e 3d 31 2e 30 2e  30 00 43 6f 6d 6d 6f 6e  |ion=1.0.0.Common|
00000020  50 72 6f 67 72 61 6d 46  69 6c 65 73 3d 43 3a 5c  |ProgramFiles=C:\|
00000030  50 72 6f 67 72 61 6d 20  46 69 6c 65 73 5c 43 6f  |Program Files\Co|
00000040  6d 6d 6f 6e 20 46 69 6c  65 73 00 43 4f 4d 50 55  |mmon Files.COMPU|
00000050  54 45 52 4e 41 4d 45 3d  41 4e 44 52 45 59 2d 56  |TERNAME=ANDREY-V|
00000060  49 53 54 41 00 43 6f 6d  53 70 65 63 3d 43 3a 5c  |ISTA.ComSpec=C:\|
00000070  57 69 6e 64 6f 77 73 5c  73 79 73 74 65 6d 33 32  |Windows\system32|
00000080  5c 63 6d 64 2e 65 78 65  00 43 55 44 41 5f 42 49  |\cmd.exe.CUDA_BI|
00000090  4e 5f 50 41 54 48 3d 43  3a 5c 43 55 44 41 5c 62  |N_PATH=C:\CUDA\b|
000000a0  69 6e 00 43 55 44 41 5f  49 4e 43 5f 50 41 54 48  |in.CUDA_INC_PATH|
000000b0  3d 43 3a 5c 43 55 44 41  5c 69 6e 63 6c 75 64 65  |=C:\CUDA\include|
000000c0  00 43 55 44 41 5f 4c 49  42 5f 50 41 54 48 3d 43  |.CUDA_LIB_PATH=C|
000000d0  3a 5c 43 55 44 41 5c 6c  69 62 00 44 46 53 54 52  |:\CUDA\lib.DFSTR|
000000e0  41 43 49 4e 47 4f 4e 3d  46 41 4c 53 45 00 46 50  |ACINGON=FALSE.FP|
000000f0  5f 4e 4f 5f 48 4f 53 54  5f 43 48 45 43 4b 3d 4e  |_NO_HOST_CHECK=N|
00000100

b:\>


IHBT as in ``I have been trolling''?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List