I have a C++ gcc leaking program with 326 sections like the following
33300000-33500000 rwxp 33300000 00:00 0
Size: 2048 kB
Rss: 620 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 244 kB
Private_Dirty: 376 kB
I was wondering what kind of allocation cause additions of 2MB writable code segments to the program. Usually I see such sections which are used as stack memory for threads but they are 10 MB large.
r = read
w = write
x = execute
s = shared
p = private (copy on write)
Usually I see such sections which are used as stack memory for threads
Yes, it is exceedingly likely that you are leaking threads. You can confirm this by looking in /proc/<pid>/task
and checking whether you have 326 threads more than you expect. Alternatively, GDB info thread
will also list all threads.
Note: the fact that your stacks are executable means that you don't have GNU_STACK
segment in your binary or one of its required shared libraries, which is a generally a bad idea.
but they are 10 MB large.
The size of stack segments depends on current ulimit -s
setting, as well as any setrlimit(..., RLIMIT_STAck, ...)
or pthread_attr_setstacksize()
calls that the application itself may perform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With