fix norm and set chunk sizes

This commit is contained in:
2024-12-03 19:03:30 +01:00
parent 231b283e0d
commit 7dfa7eb049
10 changed files with 241 additions and 186 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/26 16:38:01 by tomoron #+# #+# */
/* Updated: 2024/12/02 20:18:33 by tomoron ### ########.fr */
/* Updated: 2024/12/03 15:21:41 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,12 +20,11 @@
# define PAGE_SIZE sysconf(_SC_PAGESIZE)
# define TINY_MALLOC 256
# define SMALL_MALLOC 4096
# define TINY_MALLOC 1024
# define SMALL_MALLOC 4096
# define TINY_CHUNK_SIZE (((16 + TINY_MALLOC) * 100) + 32)
# define SMALL_CHUNK_SIZE 524288
# define TINY_CHUNK_SIZE align(((16 + TINY_MALLOC) * 100) + 32, PAGE_SIZE)
# define SMALL_CHUNK_SIZE align(((16 + SMALL_MALLOC) * 100) + 32, PAGE_SIZE)
typedef struct s_alloc
{
@ -45,15 +44,17 @@ typedef struct s_allocations
{
t_mem_chunk *tiny;
t_mem_chunk *small;
t_alloc *large;
t_alloc *large;
} t_allocations;
typedef unsigned long t_ul;
typedef unsigned long t_ul;
extern t_allocations g_allocs;
size_t align(size_t nb, size_t align_nb);
void *malloc(size_t size);
void show_alloc_mem();
void show_alloc_mem(void);
void free(void *ptr);
void *realloc(void *ptr, size_t size);