I was testing valgrind and came up to this code, which only mallocs structure.
#include "env.h"
int main(int argc, char **argv, char **envp)
{
t_env *env;
int i;
env = malloc(sizeof(t_env));
return (0);
}
typedef struct s_env
{
char **global_env;
int global_size;
} t_env;
I can't figure out why this is considered definitely lost. Shouldn't it be considered still reachable? Would be glad to teach me!
Sorry , I found out this behavior, that it's right to call definitely lost reading this article Why valgrind report my memory as "definitely lost"?
when it comes to global variable, and not freeing, then it's considered still reachable. But when it's local variable, it's considered definitely lost.