RE: Memory leak in uClinux 2.4.24

"Petersen, Joel (GE Healthcare)" <[email protected]> Mon, 21 Jun 2010 16:55:33 -0400
Newsgroups gmane.comp.hardware.motorola.microcontrollers.coldfire
Message-ID <9347757D0DCF4A439ECD105389B81B1C024F06C5@CINMLVEM21.e2k.ad.ge.com>
This is a multi-part message in MIME format.

------_=_NextPart_001_01CB1184.17654CFB
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Upon further investigation, all of my system( ) calls leak. Not just the
"busybox" ones.
=20
Is this related to the shell I have installed? It's been a while since I
configured the kernel so it'll take a while to figure out which one I
have.
=20
Joel

________________________________

From: [email protected] [mailto:[email protected]]
On Behalf Of Petersen, Joel (GE Healthcare)
Sent: Monday, June 21, 2010 12:43 PM
To: Petersen, Joel (GE Healthcare)
Subject: RE: [ColdFire] Memory leak in uClinux 2.4.24


I had built my kernel to use the busybox version of date, echo, and
others. So "date" is the same as "busybox date." I tried it anyway to
verify that the leak is there either way.
=20
Joel

________________________________

From: [email protected] [mailto:[email protected]]
On Behalf Of Ken Kerr
Sent: Monday, June 21, 2010 9:06 AM
To: Petersen, Joel (GE Healthcare)
Subject: RE: [ColdFire] Memory leak in uClinux 2.4.24



We set the date as follows (no busybox) :

=20

    sprintf(msg, "date %s", dateTimeStr);  where dateTimeStr =3D
MMDDHHMMYYYY

    system(msg);

=20

Ken Kerr

Synchrony, Inc

(540) 444-4226

=20

This email may contain information that is proprietary, privileged,
and/or confidential and is intended exclusively for the person(s) to
whom it is addressed. Any use, copying, retention, or disclosure by any
person other than the intended recipient or the intended recipient's
designees is strictly prohibited. If you are not the intended recipient
or their designee, please notify the sender immediately by return email
and delete all copies of this email.

=20

=20

From: [email protected] [mailto:[email protected]]
On Behalf Of Petersen, Joel (GE Healthcare)
Sent: Monday, June 21, 2010 9:50 AM
To: Ken Kerr
Subject: [ColdFire] Memory leak in uClinux 2.4.24

=20

Hello

=20

I have a system using uClinux 2.4.24 on Coldfire 5282, slaved to a host
PC. I was investigating a problem when I found that the way I was
setting the system date and time from the host PC with my application
generated a memory leak. The application memory space grows by 96 bytes
on every call. I can't tell if the memory leak is the problem I'm
chasing, but I want to fix the leak.

=20

The call I use is:

    sprintf(msg, "busybox date %s", dateTimeStr);

    system(msg);

=20

For testing, I changed the call to:

    system("busybox echo test");

and I still saw the memory leak.

=20

It looks like calling busybox is the problem. Upgrading uClinux (e.g. to
2.6.x) is not an option. I took a look at moving the busybox date source
to my application, but found that the stime( ) call wouldn't run in user
space.

=20

1. Is this a known bug in busybox?

2. Am I invoking busybox wrong?

3. Is there an alternative way to set the date and time?

4. I have my own drivers. Can I set date and time from a driver?

=20

Thanks in advance.

Joel Petersen

GE Healthcare

=20

=20

[email protected] Send a post to the list.
[email protected] Join the list. [email protected]
Join the list in digest mode. [email protected] Leave the
list.

[email protected] Send a post to the list.
[email protected] Join the list. [email protected]
Join the list in digest mode. [email protected] Leave the
list. [email protected] Send a post to the list.
[email protected] Join the list. [email protected]
Join the list in digest mode. [email protected] Leave the
list.

------_=_NextPart_001_01CB1184.17654CFB
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns=3D"http://www.w3.org/TR/REC-html40" xmlns:v =3D=20
"urn:schemas-microsoft-com:vml" xmlns:o =3D=20
"urn:schemas-microsoft-com:office:office" xmlns:w =3D=20
"urn:schemas-microsoft-com:office:word" xmlns:m =3D=20
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.6000.17023" name=3DGENERATOR>
<STYLE>@font-face {
	font-family: Cambria Math;
}
@font-face {
	font-family: Calibri;
}
@font-face {
	font-family: Tahoma;
}
@font-face {
	font-family: Comic Sans MS;
}
@page WordSection1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; =
}
P.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New =
Roman","serif"
}
LI.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New =
Roman","serif"
}
DIV.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New =
Roman","serif"
}
A:link {
	COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
	COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
	COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
	COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P {
	FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: =
"Times New Roman","serif"; mso-style-priority: 99; mso-margin-top-alt: =
auto; mso-margin-bottom-alt: auto
}
SPAN.EmailStyle18 {
	COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: =
personal-reply
}
.MsoChpDefault {
	FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.WordSection1 {
	page: WordSection1
}
</STYLE>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=3DEN-US vLink=3Dpurple link=3Dblue>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D979035220-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Upon further investigation, all of my system( ) =
calls leak.=20
Not just the "busybox" ones.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D979035220-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D979035220-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Is this related to the shell I have installed? =
It's been a=20
while since I configured the kernel so it'll take a while to figure out =
which=20
one I have.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D979035220-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D979035220-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Joel</FONT></SPAN></DIV><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> [email protected]=20
[mailto:[email protected]] <B>On Behalf Of </B>Petersen, Joel =
(GE=20
Healthcare)<BR><B>Sent:</B> Monday, June 21, 2010 12:43 PM<BR><B>To:</B> =

Petersen, Joel (GE Healthcare)<BR><B>Subject:</B> RE: [ColdFire] Memory =
leak in=20
uClinux 2.4.24<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D212273617-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>I had built my kernel to use the busybox =
version of date,=20
echo, and others. So "date" is the same as "busybox date." I&nbsp;tried =
it=20
anyway&nbsp;to verify that the leak is there either =
way.</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D212273617-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D212273617-21062010><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Joel</FONT></SPAN></DIV><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> [email protected]=20
[mailto:[email protected]] <B>On Behalf Of </B>Ken=20
Kerr<BR><B>Sent:</B> Monday, June 21, 2010 9:06 AM<BR><B>To:</B> =
Petersen, Joel=20
(GE Healthcare)<BR><B>Subject:</B> RE: [ColdFire] Memory leak in uClinux =

2.4.24<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=3DWordSection1>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: =
'Calibri','sans-serif'">We=20
set the date as follows (no busybox) :<o:p></o:p></SPAN></P>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: =
'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=3DMsoNormal>&nbsp;&nbsp;&nbsp; <SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">sprintf(msg, "date=20
%s", dateTimeStr);&nbsp; where dateTimeStr =3D =
MMDDHHMMYYYY</SPAN><o:p></o:p></P>
<P class=3DMsoNormal>&nbsp;&nbsp;&nbsp; <SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">system(msg);</SPAN><o:p></o:p></P>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: =
'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Comic Sans =
MS'">Ken=20
Kerr</SPAN><SPAN style=3D"COLOR: #1f497d"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: #1f497d; FONT-FAMILY: =
'Arial','sans-serif'">Synchrony,=20
Inc</SPAN><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: =
'Calibri','sans-serif'"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: #1f497d; FONT-FAMILY: =
'Arial','sans-serif'">(540)=20
444-4226</SPAN><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: =
'Calibri','sans-serif'"><o:p></o:p></SPAN></P>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: =
'Calibri','sans-serif'">&nbsp;<o:p></o:p></SPAN></P>
<P class=3DMsoNormal><I><SPAN=20
style=3D"FONT-SIZE: 7.5pt; COLOR: #1f497d; FONT-FAMILY: 'Courier =
New'">This email=20
may contain information that is proprietary, privileged, and/or =
confidential and=20
is intended exclusively for the person(s) to whom it is addressed. Any =
use,=20
copying, retention, or disclosure by any person other than the intended=20
recipient or the intended recipient's designees is strictly prohibited. =
If you=20
are not the intended recipient or their designee, please notify the =
sender=20
immediately by return email and delete all copies of this=20
email.<o:p></o:p></SPAN></I></P>
<P class=3DMsoNormal><SPAN=20
style=3D"COLOR: #1f497d"><o:p>&nbsp;</o:p></SPAN></P></DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: =
'Calibri','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>
<DIV>
<DIV=20
style=3D"BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: =
#b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: =
medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=3DMsoNormal><B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Tahoma','sans-serif'">From:</SPAN></B><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">=20
[email protected] [mailto:[email protected]] <B>On =
Behalf=20
Of </B>Petersen, Joel (GE Healthcare)<BR><B>Sent:</B> Monday, June 21, =
2010 9:50=20
AM<BR><B>To:</B> Ken Kerr<BR><B>Subject:</B> [ColdFire] Memory leak in =
uClinux=20
2.4.24<o:p></o:p></SPAN></P></DIV></DIV>
<P class=3DMsoNormal><o:p>&nbsp;</o:p></P>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">Hello</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">I have a =
system using=20
uClinux 2.4.24 on Coldfire 5282, slaved to a host PC. I was =
investigating a=20
problem when I found that the way I was setting the system date and time =
from=20
the host PC&nbsp;with my application generated a memory leak. The =
application=20
memory space grows by 96 bytes on every call. I can't tell if the memory =
leak is=20
the problem I'm chasing, but I want to fix the =
leak.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">The call I =
use=20
is:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;&nbsp;&nbsp; <SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">sprintf(msg, "busybox=20
date %s", dateTimeStr);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;&nbsp;&nbsp; <SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">system(msg);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">For =
testing, I=20
changed the call to:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;&nbsp;&nbsp; <SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">system("busybox echo=20
test");</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">and I =
still&nbsp;saw=20
the memory leak.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">It looks =
like calling=20
busybox is the problem. Upgrading uClinux (e.g. to 2.6.x) is not an =
option. I=20
took a look at moving&nbsp;the busybox date&nbsp;source to my =
application, but=20
found that the stime( ) call wouldn't run in user=20
space.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">1. =
Is&nbsp;this a=20
known bug in&nbsp;busybox?</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">2. Am I =
invoking=20
busybox wrong?</SPAN><o:p></o:p></P></DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">3. Is there =
an=20
alternative way to set the date and time?</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">4. I have =
my own=20
drivers. Can I set date and time from a =
driver?</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV>
<DIV>
<P class=3DMsoNormal><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Thanks in=20
advance.</SPAN><o:p></o:p></P></DIV>
<P><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">Joel</SPAN>&nbsp;<SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
'Arial','sans-serif'">Petersen</SPAN><o:p></o:p></P>
<P><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">GE =

Healthcare</SPAN><o:p></o:p></P>
<P>&nbsp;<o:p></o:p></P>
<DIV>
<P class=3DMsoNormal>&nbsp;<o:p></o:p></P></DIV>
<P class=3DMsoNormal>[email protected] Send a post to the list.=20
[email protected] Join the list. [email protected] =
Join the=20
list in digest mode. [email protected] Leave the=20
list.<o:p></o:p></P></DIV>[email protected] Send a post to the list. =

[email protected] Join the list. [email protected] =
Join the=20
list in digest mode. [email protected] Leave the list.=20
[email protected] Send a post to the list. =
[email protected] Join=20
the list. [email protected] Join the list in digest mode.=20
[email protected] Leave the list.</BODY></HTML>

[email protected]=09Send a post to the list.
[email protected]=09Join the list.
[email protected]=09Join the list in digest mode.
[email protected]=09Leave the list.
------_=_NextPart_001_01CB1184.17654CFB--