still working on memory stuff

This commit is contained in:
Maieul BOYER 2024-05-08 19:35:13 +02:00
parent 8e90a858ad
commit 326c9318e4
No known key found for this signature in database
18 changed files with 206 additions and 77 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/07 09:48:17 by maiboyer #+# #+# */
/* Updated: 2024/05/07 22:03:02 by maiboyer ### ########.fr */
/* Updated: 2024/05/08 19:15:05 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,14 +17,14 @@
#include "me/types.h"
#include <stdalign.h>
#define ARENA_SIZE_DEFAULT 4096
#define ARENA_SIZE_DEFAULT 4096 * 2 * 2
typedef struct s_arena_block
{
t_usize size;
bool end;
bool free;
t_u8 padding[6];
t_usize size;
bool end;
bool used;
t_u8 padding[6];
} t_arena_block;
typedef struct s_arena_page
@ -39,6 +39,9 @@ t_arena_page *get_head_arena(void);
// Will return ERROR if it couldn't malloc the page
t_error alloc_arena_page(t_usize min_size, t_arena_page **out);
t_error get_block_for_page(t_usize size, t_arena_page *page, t_arena_block **out);
t_error get_block_for_page(t_usize size, t_arena_page *page,
t_arena_block **out);
void print_pages_info(void);
t_arena_page *get_page_from_ptr(void *ptr);
#endif /* ALLOC_INTERNAL_H */

View file

@ -56,7 +56,7 @@ typedef struct s_blx
void *win;
t_blx_input inputs;
t_run_function func;
t_free_function free;
t_free_function me_free;
t_blx_app app;
t_blx_data _data;
} t_blx;

View file

@ -64,7 +64,7 @@ See the function declaration below for the signature and more information.
If you don't want/need the qoi_read and qoi_write functions, you can define
QOI_NO_STDIO before including this library.
This library uses malloc() and free(). To supply your own malloc implementation
This library uses malloc() and me_free(). To supply your own malloc implementation
you can define QOI_MALLOC and QOI_FREE before including this library.
This library uses memset() to zero-initialize the index. To supply your own
@ -273,7 +273,7 @@ The function either returns NULL on failure (invalid data, or malloc or fopen
failed) or a pot_i32er to the decoded pixels. On success, the t_qoi_desc struct
will be filled with the description from the file header.
The returned pixel data should be free()d after use. */
The returned pixel data should be me_free()d after use. */
void *qoi_read(t_const_str filename, t_qoi_desc *desc,
t_i32 channels);
@ -286,7 +286,7 @@ The function either returns NULL on failure (invalid parameters or malloc
failed) or a pot_i32er to the encoded data on success. On success the out_len
is set to the size in bytes of the encoded data.
The returned qoi data should be free()d after use. */
The returned qoi data should be me_free()d after use. */
void *qoi_encode(const void *data, const t_qoi_desc *desc,
t_i32 *out_len);
@ -297,7 +297,7 @@ The function either returns NULL on failure (invalid parameters or malloc
failed) or a pot_i32er to the decoded pixels. On success, the t_qoi_desc struct
is filled with the description from the file header.
The returned pixel data should be free()d after use. */
The returned pixel data should be me_free()d after use. */
void *qoi_decode(const void *data, t_i32 size, t_qoi_desc *desc,
t_i32 channels);

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/03 14:31:12 by maiboyer #+# #+# */
/* Updated: 2024/05/08 16:11:35 by maiboyer ### ########.fr */
/* Updated: 2024/05/08 19:27:44 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */