added support for MALLOC_PERTURB_ environment variable
This commit is contained in:
parent
0fd85cf568
commit
6d84b2f72a
17 changed files with 453 additions and 404 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: thrieg < thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/11/17 15:06:51 by thrieg #+# #+# */
|
||||
/* Updated: 2025/11/28 17:24:33 by thrieg ### ########.fr */
|
||||
/* Updated: 2025/12/08 15:32:10 by thrieg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -45,17 +45,19 @@ typedef struct s_zone
|
|||
|
||||
typedef struct s_header
|
||||
{
|
||||
size_t size; // lock zone_mut
|
||||
bool occupied; // lock zone_mut
|
||||
size_t size; // lock
|
||||
bool occupied; // lock
|
||||
t_zone *zone;
|
||||
char padding[8];
|
||||
} t_header;
|
||||
|
||||
typedef struct s_state
|
||||
{
|
||||
t_zone *tiny_zone; // lock g_mut
|
||||
t_zone *small_zone; // lock g_mut
|
||||
t_zone *large_zone; // lock g_mut, 1 zone per alloc for large
|
||||
t_zone *tiny_zone; // lock g_mut
|
||||
t_zone *small_zone; // lock g_mut
|
||||
t_zone *large_zone; // lock g_mut, 1 zone per alloc for large
|
||||
unsigned char patern; // patern set in MALLOC_PERTURB_ environment variable (lock g_mut)
|
||||
bool is_init;
|
||||
} t_state;
|
||||
|
||||
extern t_state g_state;
|
||||
|
|
@ -65,5 +67,6 @@ void *add_large(size_t size);
|
|||
void *add_small(size_t size);
|
||||
void *add_tiny(size_t size);
|
||||
void *add_page(t_type type);
|
||||
void init_env_variables();
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue