This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Realloc returns NULL


> Did you check the value of errno? It will be set to ENOMEM if you ran
> out of memory.

It is set to ENOMEM, although I can't figure out why, since I have
memory left. Top reports

Mem:   3368260k total,  2730120k used,   638140k free,   101376k buffers
Swap:  9863868k total,    49512k used,  9814356k free,  1838388k cached

which is actually much higher than what the System Monitor says is
used (772MB). In any case, the swap is hardly used, so it seems that
there is memory to spare (and I'm only realloc-ing 320K).

Running ulimit -a gives:
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 32768
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 32768
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

For the crashing thread, I get the following from executing "cat
/proc/17702/task/17707/status"
Name:	GeoView2D
State:	T (tracing stop)
Tgid:	17702
Pid:	17707
PPid:	17701
TracerPid:	17701
Uid:	1000	1000	1000	1000
Gid:	1000	1000	1000	1000
FDSize:	32
Groups:	4 20 24 25 29 30 44 46 104 108 110 115 117 127 1000
VmPeak:	  136244 kB
VmSize:	  130808 kB
VmLck:	    3372 kB
VmHWM:	   63152 kB
VmRSS:	   62828 kB
VmData:	   63312 kB
VmStk:	      84 kB
VmExe:	      24 kB
VmLib:	   64592 kB
VmPTE:	     144 kB
Threads:	5
SigQ:	1/32768
SigPnd:	0000000000000000
ShdPnd:	0000000000000000
SigBlk:	0000000000000000
SigIgn:	0000000000000000
SigCgt:	0000000180000000
CapInh:	0000000000000000
CapPrm:	0000000000000000
CapEff:	0000000000004000
Cpus_allowed:	0f
Mems_allowed:	1
voluntary_ctxt_switches:	3517
nonvoluntary_ctxt_switches:	845

Plus, again, "valgrind --leak-check=full" reports no errors.

When I set MALLOC_CHECK_=3 in my environment to abort when a problem
is detected, I cannot get the program to crash. It apparently is using
a different version of realloc?

Any other ideas for tracking this down?

Thanks,
Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]