I was digging into the memory leak that occurs in plbuf, specifically in 
rdbuf_text().  An array is allocated to store the unicode characters that were 
stored in the buffer so that it can be replayed (e.g. during a resize event).  
There are several ways to fix this problem.

1) Add a free() at the end of rdbuf_text()
  - Pros:  A minor change and I think it fixed the problem
  - Cons:  With the memory buffer, the malloc is not necessary and we are doing 
needless memcpy's

2) Remove the need to malloc and point the unicode array to the correct spot in 
the buffer
  - Pros: Avoids the malloc and a memcpy
  - Cons: Would have to add a malloc() and free() to support the old temporary 
file approach

I prefer the second approach because I like to avoid unnecessary malloc() and 
free().  Also, I think the BUFFERED_FILE blocks in plbuf.c at this point are 
just clutter.  Does anyone build plplot with BUFFERED_FILE turned on?  Has it 
even be tested?
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to