This article is a malloc's program crash!
During article 12 we informed the compiler to prepare a memory pool allocation using the init_mempool function and writing the declaretion unsigned int b [200] ; , asking for an allocation of 400 bytes. But if you write unsigned int b [250]; the program crash. The reason is that we try to do allocation in stack.
A safe allocation is outside stack. In this case we can write unsigned int sdata b[250];
Here we give an example writing unsigned int sdata[400]; so the program can accept large integer ,say 19.
Take the C code.
See the story. |