hi.
is possible check how much memory is allocated and how much memory is really used with application in linux?

i want write this info into my application.

i use this:
Qt Code:
  1. const static char StatFile[] = "/proc/self/stat";
  2. QScopedPointer<FILE, FileCloser> stat(::fopen(StatFile, "r"));
  3. if ( !stat ) {
  4. qWarning() << __FILE__ << __LINE__ << "Cannot open stat file";
  5. return -1;
  6. }
  7.  
  8. unsigned long vmsize(0), rss(0);
  9. int r = ::fscanf(stat.data(),
  10. "%*d%*s%*s%*d%*d%*d%*d%*d%*u%*u" "%*u%*u%*u%*u%*u%*d%*d%*d%*d%*d"
  11. "%*d%*u%lu%lu", &vmsize, &rss);
  12. if ( r != 2 ) {
  13. qWarning() << __FILE__ << __LINE__ << "Cannot read vmsize and resident size";
  14. return -1;
  15. }
  16.  
  17. const static long PageSize = ::sysconf(_SC_PAGESIZE);
  18.  
  19. return (rss * PageSize) / 1024;
To copy to clipboard, switch view to plain text mode 

but this is only alocated memory because when i delete some object, this info of memory is not change (maybe after long time)