xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XForms] fl_set_xyplot_alphaxtics and memory allocation


From: alessandro basili
Subject: [XForms] fl_set_xyplot_alphaxtics and memory allocation
Date: Wed, 28 Sep 2011 20:26:54 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20110922 Thunderbird/7.0

Dear xforms developers,
my team is using xforms-1.0 and we have an apparently simple problem
with xyplot and specifically with fl_set_xyplot_alphaxtics.
Our applications are displaying data vs time and we use an fl_timeout
callback to read the files where data are stored.
Since we need to display the tics with special formats, we decided to
use the "alphatics" functions available in the library.
Unfortunately we noticed that every time we call the function there's a
memory allocation (performed by fl_strdup) even if the memory has
already been allocated.
This behavior causes an increase of the memory usage which affects the
long term usage of the application.

To overcome this problem we used the following trick:

fl_set_xyplot_xtics();        //deallocates axtic with free_atic
fl_set_xyplot_alphaxtics();   //allocates axtic with fl_strdup

in this way we can "control" the usage of the memory.
Unfortunately we can neither access to the FL_XYPLOT_SPEC structure
directly since it is privately defined (and I think is a good choice!),
nor call free_axtic directly since is static, but I believe there should
be a better way to accomplish the very same result without the need to
call a function that we don't need.

Hope someone can suggest a better solution.
Regards,

Al



reply via email to

[Prev in Thread] Current Thread [Next in Thread]