Title: XbaeMatrixAddRows using XtRealloc leaking memory?

I've been trying to track down a memory leak in an application and it seems like my problem is within XbaeMatrixAddRows.  What I've been doing to track memory usage of a process is through this command:

        ps -ek -opid,ppid,etime,time,vsz,args

I have a function/driver that adds one row into a matrix using XbaeMatrixAddRows then deletes that row by calling XbaeMatrixDeleteRows:

        XbaeMatrixAddRows(Mw, XbaeMatrixNumRows(Mw), str, NULL, NULL, 1);
        XbaeMatrixDeleteRows(Mw, 0, 1);

        /* Mw is the matrix, str contains a fixed size string to be displayed in the list */

If I call this function thousands of times, I will see the vsz output (memory usage for the process) steadily increase.    I wasn't expecting the memory usage to increase because I assumed that  XbaeMatrixDeleteRows deleted the row that was created and XtRealloc wouldn't malloc more memory since the string size did not change. 

I ran Insure/Inuse and Valgrind on this driver and both reported no heap growth however the ps command shows an increase in memory usage over time.  Anyone have any thoughts?  I would really appreciate any help you can provide.

Carl Stahl  

Reply via email to