Article View: comp.windows.x
Article #8124Re: Serious leak/bug in XtAppAddWorkProc (X11R4, Ultrix 4.2a, SunOs 4.1.3).
From: Donna Converse
Date: Tue, 15 Sep 1992 18:14
Date: Tue, 15 Sep 1992 18:14
40 lines
1840 bytes
1840 bytes
> This simple program leaks like hell... We strongly suspect the
> XtAppAddWorkProc which is done in the TimeOut function.
In most R4 Xt libraries, returning True from a work procedure will cause
a memory leak. To work around the bug, the work procedure can be removed
from the queue of work procedures by calling XtRemoveWorkProc, which will
not leak; however please note that it is unacceptable practice to make
this call from the same work procedure which is being removed.
> Is there any fix for this leak. (I have not tried in X11R5)
This bug is not present in the R5 Xt library.
And sure, there's a fix, and if you have the source you can fix it
yourself. Make the following change (the single line marked by
an exclaimation point; buggy code appears first, correct code
appears second) to the code in CallWorkProc in the file NextEvent.c.
if (delete) {
w->next = freeWorkRecs;
! freeWorkRecs = w->next;
}
else {
w->next = app->workQueue;
--- ---
if (delete) {
w->next = freeWorkRecs;
! freeWorkRecs = w;
}
else {
w->next = app->workQueue;
Donna Converse
MIT X Consortium
Technical Details
Message-ID:
<1992Sep15.181421.24693@mintaka.lcs.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!sdd.hp.com!spool.mu.edu!olivea!mintaka.lcs.mit.edu!expo.lcs.mit.edu!converseReferences:
<FELIX.92Sep12145605@idefix.laas.fr>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!sdd.hp.com!spool.mu.edu!olivea!mintaka.lcs.mit.edu!expo.lcs.mit.edu!converse From: converse@expo.lcs.mit.edu (Donna Converse) Newsgroups: comp.windows.x Subject: Re: Serious leak/bug in XtAppAddWorkProc (X11R4, Ultrix 4.2a, SunOs 4.1.3). Message-ID: <1992Sep15.181421.24693@mintaka.lcs.mit.edu> Date: 15 Sep 92 18:14:21 GMT References: <FELIX.92Sep12145605@idefix.laas.fr> Sender: converse@excess.lcs.mit.edu (Donna Converse) Distribution: comp Organization: X Consortium, MIT Laboratory for Computer Science Lines: 40