Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, We are having igawk statement calling gawk function and processing a master file, each gawk function have rules and action. We are using associative array to keep the output ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    1

    memory leak in igawk script

    Hi,
    We are having igawk statement calling gawk function and processing a master file, each gawk function have rules and action. We are using associative array to keep the output of each rule and finally printing the associative array. We are seeing the memory is growing incrementally in TOP command (size, res). We are deleting the associatve arrays after each pass.

    igawk --re-interval -F -v OFS= -f symc.import.awk.Utils -f constants -f utilities -f file1.gawk -f file2.gawk -f file3.gawk -f file4.gawk -f file5.gawk -f file5.gawk "master.txt"

    1. What are the tools I can use to find the memory leak
    2. What could cause memory leak in gawk with associative array

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Without looking at your code, there is no way to tell what is causing your leak. I presume all your code is awk/gawk/igawk script code?

    As for igawk/gawk themselves, they might have a leak. Get the source and a memory leak and bounds checker tool like IBM/Rational's Purify.

    All that aside, it is possible that this is not a leak per se, but simply the result of memory fragmentation over time. The results appear at the operating system level like a memory leak, and in effect is just that. However, from the purely technical perspective at the application level, memory is being returned to the heap manager as expected. Dealing with fragmentation issues is a common problem with long running applications that do a lot of string manipulation, especially with a mix of longer and shorter strings. Many C++ libraries, such as Rogue-Wave's Tools.h++, have special-purpose class allocators to deal with this sort of situation. Unfortunatly, this is not so easy with standard malloc/free or new/delete methods.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...