Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know a thread memory usage?

is it possible to know how much memory is being used by a given phtread thread? I am interested by a VmRSS like information.

like image 418
Jérôme Avatar asked Sep 19 '25 00:09

Jérôme


1 Answers

Each thread consumes a stack which is of fixed size and created when the thread starts. It is generally 512 K / 1M but it's only virtual size at startup.

However, for dynamically-allocated data (malloc), it's a process-wide information, not per-thread. Note that some alternative malloc implementations (like tcmalloc) could provide more advanced statistics.

like image 146
Zorglub Avatar answered Sep 20 '25 14:09

Zorglub