What is the difference between xmalloc and malloc?

xmalloc() is a non-standard function that has the motto succeed or die. If it fails to allocate memory, it will terminate your program and print an error message to stderr.

The allocation itself is no different; only the behaviour in the case that no memory could be allocated is different.

Use malloc(), since it’s more friendly and standard.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)