<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Memory on Saleem Ansari</title>
    <link>/tags/memory/</link>
    <description>Recent content in Memory on Saleem Ansari</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>(c) 2024 Saleem Ansari</copyright>
    <lastBuildDate>Fri, 14 Nov 2014 21:02:13 +0530</lastBuildDate>
    <atom:link href="/tags/memory/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Check memory limit on a server</title>
      <link>/2014/11/14/check-memory-limit-on-a-server/</link>
      <pubDate>Fri, 14 Nov 2014 21:02:13 +0530</pubDate>
      <guid>/2014/11/14/check-memory-limit-on-a-server/</guid>
      <description>This is a simple C program to check memory limit on a server.&#xA;#include &amp;lt;stdio.h&amp;gt; #include &amp;lt;stdlib.h&amp;gt; int main(int argc, char* argv[]) { const int KB = 1024; /* bytes */ const int MB = 1024 * KB; /* bytes */ const int GB = 1024 * MB; /* bytes */ long size = 0; void *p = NULL; int ctr; int j; int times = 100000; long sum = 0; for(ctr = 0; ctr &amp;lt; times; ctr ++ ) { size = 10 * MB; printf(&amp;#34;Allocating %zu bytes memory \n&amp;#34;, size); p = calloc(1, size); if(p !</description>
    </item>
    <item>
      <title>Memory consumption by a .so file for a running process</title>
      <link>/2012/12/06/memory-consumption-by-a-.so-file-for-a-running-process/</link>
      <pubDate>Thu, 06 Dec 2012 00:00:00 +0000</pubDate>
      <guid>/2012/12/06/memory-consumption-by-a-.so-file-for-a-running-process/</guid>
      <description>I wanted to know how much memory is consumed by C++ standard library for a process running on Linux. There is no straightforward way I could find so I have written a small script to do exactly that.&#xA;Script Location: https://gist.github.com/4215536&#xA;How to use?&#xA;$ wget https://raw.github.com/gist/4215536/6ae899f454fd72ba3b6202724e15f855f80e33b3/mem-usage.rb $ ruby ./mem-usage.rb /proc/5952/maps | grep libstd /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16: 2988.0 KBs In the above example, 5952 is the PID of Thunderbird mail client and C++ standard library consumes 2988 KB of memory for this process.</description>
    </item>
  </channel>
</rss>
