About Me

I am Durga Prasad Jammula. I completed my B.Tech in Computer Science at IIIT, Hyderabad in 2005. I worked in CA [formerly known as Computer Associates] till July, 2008. Now, I am doing MS in Computer Science at the University of Utah, Salt lake city, USA.

Initially I wrote this tech page in googlepages. But after few days, some of my friends told me to write the same thing in blog. So, I have copy/pasted all that content in this blog and started writing new sections directly here.

10 Comments

  1. Aarthi said,

    May 21, 2007 at 12:19 pm

    Hello. I went thru ur post on memusage, I have been running this on my program to find by how much heap usage increases and also to find out how much memory is leaked. Let me know if the number of bytes leaked is to be found by subtracting the total memory freed from the heap total column value.
    Thanks in advance.

  2. DP said,

    May 24, 2007 at 7:41 pm

    Hi, memusage library is mainly for tracking memory allocation. But, I don’t think it is a good tool for finding memory leaks especially when reallocs are there. If there are no reallocs, I think you can use. But, I feel there are better solutions than that.

    1) If you have Solaris on sparc hardware, use dbx and put check -all option. It will show you memory leaks, memory overflows and places where they are happening.

    2) I have seen people using rational software to find memory leaks. But I personally don’t like it.

    3) I heard dmalloc is also a good tool. You can try that as well.

    #We use the following technique in our product.
    4) If there is an option to set custom memory functions in your product, memory leak checking can be automated in unit test cases.

    Process:

    I maintain total_memory_alloc, total_memory_freed variables.

    a) I register a custom memory functions like my_alloc, my_realloc, my_free.
    b) If the user asks for 20 bytes of memory, I will allocate 20 + 4 bytes using default malloc. In the first 4 bytes, I put the value 20. Add this 20 to total_memory_alloc.
    c) The main idea here is to store no. of bytes that we have allocated.
    d) When free is called, I decrement the pointer by 4 bytes and read that value, increment total_memory_freed variable by that much amount and free that memory using default free. In this case, if user calls my_free(a), I get the value of *(int *)((char *) a – 4). that means, in this case, it is 20. So, I increment total_memory_freed by 20. We call free on ((char *)a -4).
    e) Finally, at the end of test case, I check whether total_memory_allocated and total_memory_freed variables have the same values or not. If they are same, no memory leaks are found. If there is any difference, the difference amount of memory is leaked.

    But, this method does not help you to know where the leak is coming from. But, this is very good for automation in unit test cases.

    DP

  3. Deeps said,

    December 14, 2007 at 10:47 am

    Need to know the traces and logs used in sun solaris unix.

    could you give me any info(pdf/URL/any info related to it)

    Thanks
    Deeps

  4. jb said,

    February 6, 2008 at 5:51 pm

    I want to thank you for resolving the issue with firefox remembering yahoo password logon, I used your information and it worked beautifully …. what a pleasure not to type in information everytime you check your mail ….. thanks again …

  5. bibomedia said,

    February 29, 2008 at 11:24 am

    :)

  6. Mitul said,

    March 27, 2008 at 7:37 pm

    hi man,

    i want to test the memory leak on linux using threading or multiprocessing.
    can you guide me how i can do it.

  7. Durga Prasad said,

    April 21, 2008 at 8:36 am

    Hello DP,
    I strangely found your blog, when i tried to create a blog in wordpress with my name. Having the same name, we both seem to have the similar taste in writing blogs. I love to read techie stuff in the blogs.

    Any way, this message is just to appreciate your time to put on some techie stuff in to your blog. Keep posting the similar info. I will keep an eye on it. Take care.

  8. José Luis said,

    February 17, 2009 at 5:31 am

    hello Durga,I have been using memusage but I don’t understand if the heap peak , stack peak,heap total is in bytes or Kb, if you can help your me to interpret this i well be very grateful,thanks in advance.

  9. josé luis said,

    February 17, 2009 at 5:35 am

    Im trying to get the maximum peak of memory used by my program, I would like to compare the memory performance against another program
    In this case, which of those numbers(heap total, heap peak, stack peak) would answer my question?

    Thank you in advance

  10. Arunanchal Behera said,

    September 3, 2009 at 10:02 pm

    Hi DP

    I am very much interested in knowing in depth of the OS , can you guide me how I can proceed.
    Currently I am working as a Sr. System Engineer


Post a Comment