Sungju's Slow Life

Personal journal


  • Are malloc() and free() functions thread-safe?

    Recently, someone asked me why he can’t allocated enough memory with a lot of thread functions. At first, I just tried to explain that there is no problem in Linux kernel or malloc() functions. But, when double checked his code, I found that he used malloc() without any safeguard. Yeah, no synchronization around malloc(). Sigh.… Continue reading

  • What happened in my stack?

    If you write a program which requires a big chunk of memory at the time, you will notice the influences of ‘stack size’. I will show you what will happen in this stack limitation with the following simple program. #include <stdio.h> #include <malloc.h> int main() { char *a; unsigned long i, half_gb = 512 *… Continue reading

About Me

A software engineer who loves any technologies that makes life easier. That’s why I love Linux and Mac at the same time.