summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-06-28 11:00:35 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-06-28 11:00:35 +0000
commit07fb877e0a7eb9d87482b68bb45e839fdaf851d8 (patch)
tree8c7a7af071fcd1e16f87417fcf6515fd917925fa
parentf5a180ff4be1599ffc8dae38d97a42242979f809 (diff)
downloadgpsd-07fb877e0a7eb9d87482b68bb45e839fdaf851d8.tar.gz
Document that the low-level interface uses no dynamic allocation.
-rw-r--r--HACKING10
-rw-r--r--gpsd.spec.in3
-rw-r--r--libgpsd.xml11
3 files changed, 18 insertions, 6 deletions
diff --git a/HACKING b/HACKING
index 9fdc49b9..8b441781 100644
--- a/HACKING
+++ b/HACKING
@@ -315,6 +315,16 @@ enough to manage that, consider whether your feature control might be
implemented with an extension to the gpsd protocol or the
control-socket command set.
+** Don't use malloc!
+
+The best way to avoid having dynamic-memory allocation problems is
+not to use malloc/free at all. The gpsd daemon doesn't (though the
+client-side code does). Thus, even the longest-running instance
+can't have memory leaks. The only cost for this turned out to be
+embedding a PATH_MAX-sized buffer in the gpsd.h structure.
+
+Don't undo this by using malloc/free in a driver or anywhere else.
+
** Error modeling
To estimate errors (which we must do if the GPS isn't nice like a
diff --git a/gpsd.spec.in b/gpsd.spec.in
index 38189fcc..5f78b84b 100644
--- a/gpsd.spec.in
+++ b/gpsd.spec.in
@@ -132,7 +132,8 @@ cp gps.py gpsfake.py "$RPM_BUILD_ROOT"%{_libdir}/python${PYVERSION}/site-package
some minor bugs found by valgrind audit, including (1) a slow
memory leak, (2) a possible but unconfirmed file-descriptor leak,
and (3) a subtle error in the channel-assignment logic that only
- showed up with multiple sessions active.
+ showed up with multiple sessions active. In fact, the daemon code
+ no longer uses dynamic-memory allocation at all.
* Wed Jun 22 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.26
- Time DOP and total DOP are now passed on from GPSes that report
diff --git a/libgpsd.xml b/libgpsd.xml
index 05fff9be..42026372 100644
--- a/libgpsd.xml
+++ b/libgpsd.xml
@@ -144,12 +144,13 @@ ends the session, implicitly performing a
The library will use this to issue ordinary status messages. Use
first argument of 0 for errors, 1 for ordinary status messages,
and 2 or higher for debugging messages.</para>
-</refsect1>
-<!-- para>These functions do not allocate or free any dynamic storage.
-(This isn't true yet. The use of dynamic storage in the Garmin driver
-needs to be fixed.)
-</para -->
+<para>The low-level functions do not allocate or free any dynamic
+storage. They can thus be used in a long-running application (such as
+<citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+itself) with a guarantee that thwy won't cause memory leaks.</para>
+
+</refsect1>
<refsect1 id='bugs'><title>BUGS</title>