gvannest / ft_malloc

42 project which consists in coding the C dynamic memory allocation function malloc()
0 stars 0 forks source link

ft_malloc #2

Open gvannest opened 4 years ago

gvannest commented 4 years ago

Main issue for the ft_malloc function which deals with the allocation of memory

Note: free is in another issue, please refer to https://github.com/gvannest/ft_malloc/issues/1

Tasks

specific documentation for implementation

If n is zero, malloc returns a minumum-sized chunk. (The minimum
--
size is 16 bytes on most 32bit systems, and 24 or 32 bytes on 64bit
systems.)  On most systems, size_t is an unsigned type, so calls
with negative arguments are interpreted as requests for huge amounts
of space, which will often fail. The maximum supported value of n
differs across systems, but is in all cases less than the maximum
representable value of a size_t.

Main decisions on implementation

gvannest commented 4 years ago

to do next on ft_malloc branch:

gvannest commented 4 years ago

lldb command to print memory

WATCH OUT: we are in little endian (bytes are organized from left to right)

>lldb ./ft_malloc_exec


>b main_test:19 => set a breakpoint at line 19 in main_test.c


>r => run the program


{ breakpoint is reach } >memory read 0x1000df000 --count 32 => the address has been printed above during the execution of the program. 32 for 32 bytes