Thank you for your reply. >If the heap's corrupt, yes, it can fail... Could you please explain that in more detail? What confuses me is that how can it fails to shrink memory while there is enough memory pointed by the input argument of realloc(3) function ( i.e. ptr, here is the declaration of realloc(3):void *realloc(void *ptr, size_t size); ) at least. Thank you for your attention to this matter. On Tue, Aug 11, 2020 at 11:59 AM Dan Kegel <dank@xxxxxxxxx> wrote: > > If the heap's corrupt, yes, it can fail... > > On Mon, Aug 10, 2020 at 8:54 PM 孙世龙 sunshilong via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: >> >> As the subject, I couldn't find any positive or negative statements >> about this matter in the Linux Programmer's Manual. >> >> Could somebody shed some light on this matter? >> >> Thank you for your attention to this matter. >> Best regards. >> Sunshilong >>