free tous les mallocs
This commit is contained in:
@@ -2,7 +2,7 @@ NAME = philo
|
||||
|
||||
CC = clang
|
||||
|
||||
CFLAGS = -Wall -Wextra -Werror $(INCLUDES)
|
||||
CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -g3
|
||||
|
||||
VPATH = $(DIR_SRCS)
|
||||
DIR_SRCS = srcs
|
||||
|
||||
18
philo/exec.c
18
philo/exec.c
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/02/01 18:08:58 by hulamy #+# #+# */
|
||||
/* Updated: 2022/02/01 18:09:01 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/02/02 00:28:14 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -57,15 +57,22 @@ static int eat(t_philo *philo, t_mtx *fork1, t_mtx *fork2)
|
||||
}
|
||||
|
||||
/*
|
||||
if (philo->p_nbr % 2 == 0)
|
||||
usleep(10 * 1000);
|
||||
**
|
||||
** just after the assignation of the two forks :
|
||||
|
||||
if (philo->p_nbr % 2 == 0)
|
||||
{
|
||||
fork1 = &(philo->next->m_fork);
|
||||
fork2 = &(philo->m_fork);
|
||||
}
|
||||
|
||||
** just before the while :
|
||||
|
||||
if (philo->p_nbr % 2 == 0)
|
||||
usleep(10 * 1000);
|
||||
|
||||
** just at the end of the while
|
||||
|
||||
usleep(1 * 1000);
|
||||
*/
|
||||
void *philo_exec(void *arg)
|
||||
{
|
||||
@@ -88,7 +95,6 @@ void *philo_exec(void *arg)
|
||||
action_delay(philo, philo->params->t_slp);
|
||||
if (print_message(philo, B_GREEN, "is thinking"))
|
||||
break ;
|
||||
usleep(1 * 1000);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
@@ -98,7 +104,7 @@ void *philo_exec(void *arg)
|
||||
. .
|
||||
-(1) (2)- -(3) . -(1) -(2) -(3) . -(1) (2)- -(3)
|
||||
. .
|
||||
. .
|
||||
(ms) . .
|
||||
. .
|
||||
0: +-(1)-+ (2)- +-(3)- . +-(1)-+ -(2) +-(3)- . +-(1)-+ (2)- +-(3)-
|
||||
| . | . |
|
||||
|
||||
13
philo/init.c
13
philo/init.c
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:30:34 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/31 10:20:25 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/02/02 00:18:04 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -114,17 +114,20 @@ t_philo *init(int ac, char **av, pthread_t **id)
|
||||
t_params *params;
|
||||
t_global *global;
|
||||
|
||||
philo = NULL;
|
||||
params = NULL;
|
||||
global = NULL;
|
||||
params = init_params(ac, av);
|
||||
if (params == NULL)
|
||||
return (NULL);
|
||||
global = init_global();
|
||||
if (params == NULL)
|
||||
return (NULL);
|
||||
if (global == NULL)
|
||||
return (return_free(params, NULL, NULL));
|
||||
*id = malloc(sizeof(pthread_t) * params->n_phi);
|
||||
if (*id == NULL)
|
||||
return (NULL);
|
||||
return (return_free(params, global, NULL));
|
||||
philo = init_chain_philo(params, global);
|
||||
if (philo == NULL)
|
||||
return (NULL);
|
||||
return (return_free(params, global, *id));
|
||||
return (philo);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:30:49 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/31 09:57:34 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/02/01 23:44:28 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
36
philo/main.c
36
philo/main.c
@@ -6,12 +6,44 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:30:40 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/26 15:32:30 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/02/02 00:14:59 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "philo.h"
|
||||
|
||||
void *return_free(void *e1, void *e2, void *e3)
|
||||
{
|
||||
if (e1)
|
||||
free(e1);
|
||||
if (e2)
|
||||
free(e2);
|
||||
if (e3)
|
||||
free(e3);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void free_philo(t_philo *philo, int n)
|
||||
{
|
||||
t_philo *tmp;
|
||||
int i;
|
||||
|
||||
if (philo && philo->params)
|
||||
free(philo->params);
|
||||
if (philo && philo->global)
|
||||
free(philo->global);
|
||||
i = 1;
|
||||
while (i <= n && philo)
|
||||
{
|
||||
if (i < n)
|
||||
tmp = philo->next;
|
||||
free(philo);
|
||||
if (i < n)
|
||||
philo = tmp;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
pthread_t *id;
|
||||
@@ -28,5 +60,7 @@ int main(int ac, char **av)
|
||||
pthread_join(id[i], NULL);
|
||||
i++;
|
||||
}
|
||||
free_philo(philo, philo->params->n_phi);
|
||||
free(id);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/01/26 15:27:13 by hulamy #+# #+# */
|
||||
/* Updated: 2022/01/30 15:13:21 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/02/02 00:15:43 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PHILO_PROTO_H
|
||||
# define PHILO_PROTO_H
|
||||
|
||||
// main.c
|
||||
void *return_free(void *e1, void *e2, void *e3);
|
||||
|
||||
// init.c
|
||||
t_philo *init(int ac, char **av, pthread_t **id);
|
||||
|
||||
|
||||
330
philo/race.log
330
philo/race.log
@@ -1,330 +0,0 @@
|
||||
==69556== Helgrind, a thread error detector
|
||||
==69556== Copyright (C) 2007-2017, and GNU GPL'd, by OpenWorks LLP et al.
|
||||
==69556== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
|
||||
==69556== Command: ./philo 3 610 200 100 10
|
||||
==69556==
|
||||
==69556== ---Thread-Announcement------------------------------------------
|
||||
==69556==
|
||||
==69556== Thread #3 was created
|
||||
==69556== at 0x49AE282: clone (clone.S:71)
|
||||
==69556== by 0x48712EB: create_thread (createthread.c:101)
|
||||
==69556== by 0x4872E0F: pthread_create@@GLIBC_2.2.5 (pthread_create.c:817)
|
||||
==69556== by 0x4842917: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40180E: launch (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011FD: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556==
|
||||
==69556== ----------------------------------------------------------------
|
||||
==69556==
|
||||
==69556== Thread #3: lock order "0x4A812D8 before 0x4A811E8" violated
|
||||
==69556==
|
||||
==69556== Observed (incorrect) order is: acquisition of lock at 0x4A811E8
|
||||
==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x401B7C: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x4872608: start_thread (pthread_create.c:477)
|
||||
==69556== by 0x49AE292: clone (clone.S:95)
|
||||
==69556==
|
||||
==69556== followed by a later acquisition of lock at 0x4A812D8
|
||||
==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x401BE3: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x4872608: start_thread (pthread_create.c:477)
|
||||
==69556== by 0x49AE292: clone (clone.S:95)
|
||||
==69556==
|
||||
==69556== Lock at 0x4A812D8 was first observed
|
||||
==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Address 0x4a812d8 is 24 bytes inside a block of size 176 alloc'd
|
||||
==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Block was alloc'd by thread #1
|
||||
==69556==
|
||||
==69556== Lock at 0x4A811E8 was first observed
|
||||
==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Address 0x4a811e8 is 24 bytes inside a block of size 176 alloc'd
|
||||
==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Block was alloc'd by thread #1
|
||||
==69556==
|
||||
==69556==
|
||||
==69556== ---Thread-Announcement------------------------------------------
|
||||
==69556==
|
||||
==69556== Thread #2 was created
|
||||
==69556== at 0x49AE282: clone (clone.S:71)
|
||||
==69556== by 0x48712EB: create_thread (createthread.c:101)
|
||||
==69556== by 0x4872E0F: pthread_create@@GLIBC_2.2.5 (pthread_create.c:817)
|
||||
==69556== by 0x4842917: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40180E: launch (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011FD: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556==
|
||||
==69556== ----------------------------------------------------------------
|
||||
==69556==
|
||||
==69556== Thread #2: lock order "0x4A811E8 before 0x4A813C8" violated
|
||||
==69556==
|
||||
==69556== Observed (incorrect) order is: acquisition of lock at 0x4A813C8
|
||||
==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x401B7C: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x4872608: start_thread (pthread_create.c:477)
|
||||
==69556== by 0x49AE292: clone (clone.S:95)
|
||||
==69556==
|
||||
==69556== followed by a later acquisition of lock at 0x4A811E8
|
||||
==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x401BE3: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x4872608: start_thread (pthread_create.c:477)
|
||||
==69556== by 0x49AE292: clone (clone.S:95)
|
||||
==69556==
|
||||
==69556== Lock at 0x4A811E8 was first observed
|
||||
==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Address 0x4a811e8 is 24 bytes inside a block of size 176 alloc'd
|
||||
==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Block was alloc'd by thread #1
|
||||
==69556==
|
||||
==69556== Lock at 0x4A813C8 was first observed
|
||||
==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Address 0x4a813c8 is 24 bytes inside a block of size 176 alloc'd
|
||||
==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Block was alloc'd by thread #1
|
||||
==69556==
|
||||
==69556==
|
||||
==69556== ---Thread-Announcement------------------------------------------
|
||||
==69556==
|
||||
==69556== Thread #4 was created
|
||||
==69556== at 0x49AE282: clone (clone.S:71)
|
||||
==69556== by 0x48712EB: create_thread (createthread.c:101)
|
||||
==69556== by 0x4872E0F: pthread_create@@GLIBC_2.2.5 (pthread_create.c:817)
|
||||
==69556== by 0x4842917: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40180E: launch (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011FD: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556==
|
||||
==69556== ----------------------------------------------------------------
|
||||
==69556==
|
||||
==69556== Thread #4: lock order "0x4A813C8 before 0x4A812D8" violated
|
||||
==69556==
|
||||
==69556== Observed (incorrect) order is: acquisition of lock at 0x4A812D8
|
||||
==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x401B7C: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x4872608: start_thread (pthread_create.c:477)
|
||||
==69556== by 0x49AE292: clone (clone.S:95)
|
||||
==69556==
|
||||
==69556== followed by a later acquisition of lock at 0x4A813C8
|
||||
==69556== at 0x483FEDF: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x401BE3: eat (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x401AC3: philo_exec (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4842B1A: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x4872608: start_thread (pthread_create.c:477)
|
||||
==69556== by 0x49AE292: clone (clone.S:95)
|
||||
==69556==
|
||||
==69556== Lock at 0x4A813C8 was first observed
|
||||
==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Address 0x4a813c8 is 24 bytes inside a block of size 176 alloc'd
|
||||
==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Block was alloc'd by thread #1
|
||||
==69556==
|
||||
==69556== Lock at 0x4A812D8 was first observed
|
||||
==69556== at 0x4843D9D: pthread_mutex_init (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40168D: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Address 0x4a812d8 is 24 bytes inside a block of size 176 alloc'd
|
||||
==69556== at 0x483C893: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||
==69556== by 0x40163C: lst_add_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4015AD: init_chain_philo (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4012ED: init (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== by 0x4011D5: main (in /mnt/nfs/homes/hulamy/42/philo/philosopher/philo/philo)
|
||||
==69556== Block was alloc'd by thread #1
|
||||
==69556==
|
||||
==69556==
|
||||
[0;37m1 3 has taken a fork[0m
|
||||
[0;37m11 3 has taken a fork[0m
|
||||
[1;33m12 3 is eating[0m
|
||||
[0;37m26 2 has taken a fork[0m
|
||||
[1;34m215 3 is sleeping[0m
|
||||
[0;37m216 1 has taken a fork[0m
|
||||
[0;37m217 2 has taken a fork[0m
|
||||
[1;33m217 2 is eating[0m
|
||||
[1;32m316 3 is thinking[0m
|
||||
[0;37m419 3 has taken a fork[0m
|
||||
[0;37m419 1 has taken a fork[0m
|
||||
[1;33m420 1 is eating[0m
|
||||
[1;34m420 2 is sleeping[0m
|
||||
[1;32m521 2 is thinking[0m
|
||||
[0;37m620 2 has taken a fork[0m
|
||||
[1;34m621 1 is sleeping[0m
|
||||
[0;37m623 3 has taken a fork[0m
|
||||
[1;33m623 3 is eating[0m
|
||||
[1;32m721 1 is thinking[0m
|
||||
[0;37m824 1 has taken a fork[0m
|
||||
[1;34m824 3 is sleeping[0m
|
||||
[0;37m825 2 has taken a fork[0m
|
||||
[1;33m826 2 is eating[0m
|
||||
[1;32m925 3 is thinking[0m
|
||||
[1;34m1025 2 is sleeping[0m
|
||||
[0;37m1026 3 has taken a fork[0m
|
||||
[0;37m1026 1 has taken a fork[0m
|
||||
[1;33m1027 1 is eating[0m
|
||||
[1;32m1126 2 is thinking[0m
|
||||
[0;37m1227 2 has taken a fork[0m
|
||||
[0;37m1228 3 has taken a fork[0m
|
||||
[1;33m1228 3 is eating[0m
|
||||
[1;34m1229 1 is sleeping[0m
|
||||
[1;32m1329 1 is thinking[0m
|
||||
[0;37m1430 1 has taken a fork[0m
|
||||
[0;37m1430 2 has taken a fork[0m
|
||||
[1;33m1431 2 is eating[0m
|
||||
[1;34m1435 3 is sleeping[0m
|
||||
[1;32m1535 3 is thinking[0m
|
||||
[0;37m1631 3 has taken a fork[0m
|
||||
[0;37m1632 1 has taken a fork[0m
|
||||
[1;33m1632 1 is eating[0m
|
||||
[1;34m1633 2 is sleeping[0m
|
||||
[1;32m1733 2 is thinking[0m
|
||||
[0;37m1833 2 has taken a fork[0m
|
||||
[1;34m1833 1 is sleeping[0m
|
||||
[0;37m1834 3 has taken a fork[0m
|
||||
[1;33m1834 3 is eating[0m
|
||||
[1;32m1934 1 is thinking[0m
|
||||
[0;37m2034 1 has taken a fork[0m
|
||||
[1;34m2034 3 is sleeping[0m
|
||||
[0;37m2035 2 has taken a fork[0m
|
||||
[1;33m2035 2 is eating[0m
|
||||
[1;32m2134 3 is thinking[0m
|
||||
[0;37m2236 3 has taken a fork[0m
|
||||
[0;37m2236 1 has taken a fork[0m
|
||||
[1;33m2237 1 is eating[0m
|
||||
[1;34m2237 2 is sleeping[0m
|
||||
[1;32m2337 2 is thinking[0m
|
||||
[0;37m2439 2 has taken a fork[0m
|
||||
[0;37m2440 3 has taken a fork[0m
|
||||
[1;33m2440 3 is eating[0m
|
||||
[1;34m2440 1 is sleeping[0m
|
||||
[1;32m2541 1 is thinking[0m
|
||||
[0;37m2641 1 has taken a fork[0m
|
||||
[0;37m2641 2 has taken a fork[0m
|
||||
[1;33m2642 2 is eating[0m
|
||||
[1;34m2642 3 is sleeping[0m
|
||||
[1;32m2742 3 is thinking[0m
|
||||
[0;37m2843 1 has taken a fork[0m
|
||||
[1;33m2843 1 is eating[0m
|
||||
[0;37m2843 3 has taken a fork[0m
|
||||
[1;34m2844 2 is sleeping[0m
|
||||
[1;32m2944 2 is thinking[0m
|
||||
[0;37m3042 2 has taken a fork[0m
|
||||
[0;37m3043 3 has taken a fork[0m
|
||||
[1;33m3043 3 is eating[0m
|
||||
[1;34m3044 1 is sleeping[0m
|
||||
[1;32m3144 1 is thinking[0m
|
||||
[0;37m3244 1 has taken a fork[0m
|
||||
[1;34m3245 3 is sleeping[0m
|
||||
[0;37m3245 2 has taken a fork[0m
|
||||
[1;33m3246 2 is eating[0m
|
||||
[1;32m3345 3 is thinking[0m
|
||||
[0;37m3447 3 has taken a fork[0m
|
||||
[0;37m3448 1 has taken a fork[0m
|
||||
[1;33m3448 1 is eating[0m
|
||||
[1;34m3450 2 is sleeping[0m
|
||||
[1;32m3550 2 is thinking[0m
|
||||
[0;37m3649 2 has taken a fork[0m
|
||||
[0;37m3649 3 has taken a fork[0m
|
||||
[1;33m3649 3 is eating[0m
|
||||
[1;34m3650 1 is sleeping[0m
|
||||
[1;32m3751 1 is thinking[0m
|
||||
[1;34m3850 3 is sleeping[0m
|
||||
[0;37m3851 2 has taken a fork[0m
|
||||
[1;33m3851 2 is eating[0m
|
||||
[0;37m3852 1 has taken a fork[0m
|
||||
[1;32m3951 3 is thinking[0m
|
||||
[0;37m4051 3 has taken a fork[0m
|
||||
[0;37m4052 1 has taken a fork[0m
|
||||
[1;33m4053 1 is eating[0m
|
||||
[1;34m4053 2 is sleeping[0m
|
||||
[1;32m4154 2 is thinking[0m
|
||||
[0;37m4253 2 has taken a fork[0m
|
||||
[0;37m4254 3 has taken a fork[0m
|
||||
[1;33m4254 3 is eating[0m
|
||||
[1;34m4255 1 is sleeping[0m
|
||||
[1;32m4355 1 is thinking[0m
|
||||
[0;37m4456 1 has taken a fork[0m
|
||||
[1;34m4456 3 is sleeping[0m
|
||||
[0;37m4456 2 has taken a fork[0m
|
||||
[1;33m4457 2 is eating[0m
|
||||
[1;32m4556 3 is thinking[0m
|
||||
[0;37m4658 3 has taken a fork[0m
|
||||
[1;34m4658 2 is sleeping[0m
|
||||
[0;37m4658 1 has taken a fork[0m
|
||||
[1;33m4658 1 is eating[0m
|
||||
[1;32m4758 2 is thinking[0m
|
||||
[0;37m4859 2 has taken a fork[0m
|
||||
[0;37m4859 3 has taken a fork[0m
|
||||
[1;33m4859 3 is eating[0m
|
||||
[1;34m4860 1 is sleeping[0m
|
||||
[1;32m4961 1 is thinking[0m
|
||||
[0;37m5059 1 has taken a fork[0m
|
||||
[0;37m5059 2 has taken a fork[0m
|
||||
[1;33m5060 2 is eating[0m
|
||||
[1;34m5061 3 is sleeping[0m
|
||||
[1;32m5161 3 is thinking[0m
|
||||
[0;37m5260 3 has taken a fork[0m
|
||||
[1;34m5261 2 is sleeping[0m
|
||||
[0;37m5262 1 has taken a fork[0m
|
||||
[1;33m5262 1 is eating[0m
|
||||
[1;32m5361 2 is thinking[0m
|
||||
[1;34m5464 1 is sleeping[0m
|
||||
[0;37m5465 3 has taken a fork[0m
|
||||
[1;33m5465 3 is eating[0m
|
||||
[0;37m5466 2 has taken a fork[0m
|
||||
[1;32m5565 1 is thinking[0m
|
||||
[0;37m5666 1 has taken a fork[0m
|
||||
[0;37m5666 2 has taken a fork[0m
|
||||
[1;33m5666 2 is eating[0m
|
||||
[1;34m5667 3 is sleeping[0m
|
||||
==69556==
|
||||
==69556== Use --history-level=approx or =none to gain increased speed, at
|
||||
==69556== the cost of reduced accuracy of conflicting-access information
|
||||
==69556== For lists of detected and suppressed errors, rerun with: -s
|
||||
==69556== ERROR SUMMARY: 28 errors from 3 contexts (suppressed: 60416 from 121)
|
||||
Reference in New Issue
Block a user