Re: Memory leak in ARInitialization (c api 7.1)

2008-04-03 Thread Axton
BMC raised a defect for this with ID SW00291932.

Axton Grams

On Sun, Mar 30, 2008 at 3:46 PM, Axton <[EMAIL PROTECTED]> wrote:

> Maybe, but that would be sloppy.  An api shouldn't leave things allocated
> that are never again accessible.
>
> If I set the locale in ARControlStruct to a multi-byte locale, that shows
> another leak.
>
>
> 
> strncpy (control.localeInfo.locale, "en_US.UTF-8", AR_MAX_LOCALE_SIZE);
> 
>
>
> (2) stop in ARTermination
> (dbx) run
> Running: sendrem
> (process id 6337)
> RTC: Enabling Error Checking...
> RTC: Running program...
> [EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 0xeb9d6848
> 0xeb9d6848: ARTermination   :   save %sp, -120, %sp
> Current function is main
>39 rtn = ARTermination (&control, &status);
> (dbx) showleaks -v
> Checking for memory leaks...
>
> Actual leaks report(actual leaks:2  total size:147
> bytes)
>
> Memory Leak (mel):
> Found leaked block of size 135 bytes at address 0x402d0
> At time of allocation, the call stack was:
> [1] UNIXInitialization() at 0xeb9d3574
> [2] _pthread_once() at 0xe19b0de0
> [3] DoARInitialization() at 0xeb9d37b8
> [4] ARInitialization() at 0xeb9d36d4
> [5] main() at line 32 in "sendrem.c"
>
> Memory Leak (mel):
> Found leaked block of size 12 bytes at address 0x435d0
> At time of allocation, the call stack was:
> [1] _setlocale() at 0xe1981ae4
> [2] ARDoConnect() at 0xeb9d3d7c
> [3] DoARInitialization() at 0xeb9d3990
> [4] ARInitialization() at 0xeb9d36d4
> [5] main() at line 32 in "sendrem.c"
>
>
>
> Possible leaks report  (possible leaks:  0  total size:  0
> bytes)
>
>
> (dbx) print (char *)0x435d0
> (char *) 0x435d0 = 0x435d0 "en_US.UTF-8"
> (dbx) print (char *)0x402d0
> (char *) 0x402d0 = 0x402d0
> "NLSPATH=/opt/SUNWspro/bin/../prod/bin/sparcv9/../../lib/locale/en_US.UTF-8/LC_MESSAGES/%N.cat:/usr/lib/locale//LC_MESSAGES/N"
>
> Axton Grams
>
>
> On Sun, Mar 30, 2008 at 6:12 AM, Wayne Keenan <[EMAIL PROTECTED]>
> wrote:
>
> > ** I'm making an educated guess, based on my experience with other C
> > API's, but it could just be some table /struct/buffer/scratch space used to
> > support the locale; which will/has to exist (and potentially not grow) for
> > the duration of the process?
> >
> > Not all memory still in use at program end is a 'leak' to be concerned
> > about, it may be required and should only be free'ed at process exit;
> > perhaps in this case that cleanup has been forgotten about?
> >
> > Just a thought.
> >
> > Regards
> > Wayne
> >
> >
> >
> > On Sun, Mar 30, 2008 at 8:21 AM, Jarl Grøneng <[EMAIL PROTECTED]>
> > wrote:
> >
> > > Strange. Seems like the message catalog doing the wrong stuff here.
> > >
> > > --
> > > Jarl
> > >
> > > On Sat, Mar 29, 2008 at 11:27 PM, Axton <[EMAIL PROTECTED]> wrote:
> > > > ** Very odd, it would appear that if the LANG env var is set, the
> > > memory
> > > > leak happens; if the env var is not set, no leak.
> > > >
> > > > In the case of the memory leak:
> > > > [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
> > > >  LANG=en_US.UTF-8
> > > > LC_CTYPE="en_US.UTF-8"
> > > > LC_NUMERIC="en_US.UTF-8"
> > > > LC_TIME="en_US.UTF-8"
> > > > LC_COLLATE="en_US.UTF-8"
> > > > LC_MONETARY="en_US.UTF-8"
> > > > LC_MESSAGES="en_US.UTF-8"
> > > >  LC_ALL=
> > > >
> > > > In the case of no leak:
> > > > [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
> > > > LANG=
> > > > LC_CTYPE="C"
> > > > LC_NUMERIC="C"
> > > > LC_TIME="C"
> > > > LC_COLLATE="C"
> > > >  LC_MONETARY="C"
> > > > LC_MESSAGES="C"
> > > > LC_ALL=
> > > >
> > > > Axton
> > > >
> > > >
> > > >
> > > > On Fri, Mar 28, 2008 at 4:05 PM, Axton <[EMAIL PROTECTED]>
> > > wrote:
> > > >
> > > > > Some add'l info:
> > > > >
> > > > > (dbx) stop in ARTermination
> > > > > dbx: warning: 'ARTermination' has no debugger info -- will trigger
> > > on
> > > > first instruction
> > > > > (2) stop in ARTermination
> > > > > (dbx) rerun
> > > > > Running: sendrem
> > > > > (process id 2990)
> > > > >
> > > > > RTC: Enabling Error Checking...
> > > > > RTC: Running program...
> > > > > [EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 
> > > > > 0xecdd6968
> > > > > 0xecdd6968: ARTermination   :   save %sp, -120, %sp
> > > > > Current function is main
> > > > >31 rtn = ARTermination (&control, &status);
> > > > > (dbx) showleaks
> > > > >
> > > > > Checking for memory leaks...
> > > > >
> > > > > Actual leaks report(actual leaks:1  total size:
> > >  154
> > > > bytes)
> > > > >
> > > > >   Total Num of  Leaked Allocation call stack
> > > > >   Size  Blocks  Block
> > > > > Address
> > > > > ==  == ===
> > > ===
> > > > >154   10x40388  UNIXInitialization < _pthread_once
> > > <
> > > > DoARInitial

Re: Memory leak in ARInitialization (c api 7.1)

2008-03-30 Thread Axton
Maybe, but that would be sloppy.  An api shouldn't leave things allocated
that are never again accessible.

If I set the locale in ARControlStruct to a multi-byte locale, that shows
another leak.



strncpy (control.localeInfo.locale, "en_US.UTF-8", AR_MAX_LOCALE_SIZE);



(2) stop in ARTermination
(dbx) run
Running: sendrem
(process id 6337)
RTC: Enabling Error Checking...
RTC: Running program...
[EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 0xeb9d6848
0xeb9d6848: ARTermination   :   save %sp, -120, %sp
Current function is main
   39 rtn = ARTermination (&control, &status);
(dbx) showleaks -v
Checking for memory leaks...

Actual leaks report(actual leaks:2  total size:147
bytes)

Memory Leak (mel):
Found leaked block of size 135 bytes at address 0x402d0
At time of allocation, the call stack was:
[1] UNIXInitialization() at 0xeb9d3574
[2] _pthread_once() at 0xe19b0de0
[3] DoARInitialization() at 0xeb9d37b8
[4] ARInitialization() at 0xeb9d36d4
[5] main() at line 32 in "sendrem.c"

Memory Leak (mel):
Found leaked block of size 12 bytes at address 0x435d0
At time of allocation, the call stack was:
[1] _setlocale() at 0xe1981ae4
[2] ARDoConnect() at 0xeb9d3d7c
[3] DoARInitialization() at 0xeb9d3990
[4] ARInitialization() at 0xeb9d36d4
[5] main() at line 32 in "sendrem.c"



Possible leaks report  (possible leaks:  0  total size:  0
bytes)


(dbx) print (char *)0x435d0
(char *) 0x435d0 = 0x435d0 "en_US.UTF-8"
(dbx) print (char *)0x402d0
(char *) 0x402d0 = 0x402d0
"NLSPATH=/opt/SUNWspro/bin/../prod/bin/sparcv9/../../lib/locale/en_US.UTF-8/LC_MESSAGES/%N.cat:/usr/lib/locale//LC_MESSAGES/N"

Axton Grams

On Sun, Mar 30, 2008 at 6:12 AM, Wayne Keenan <[EMAIL PROTECTED]>
wrote:

> ** I'm making an educated guess, based on my experience with other C
> API's, but it could just be some table /struct/buffer/scratch space used to
> support the locale; which will/has to exist (and potentially not grow) for
> the duration of the process?
>
> Not all memory still in use at program end is a 'leak' to be concerned
> about, it may be required and should only be free'ed at process exit;
> perhaps in this case that cleanup has been forgotten about?
>
> Just a thought.
>
> Regards
> Wayne
>
>
>
> On Sun, Mar 30, 2008 at 8:21 AM, Jarl Grøneng <[EMAIL PROTECTED]>
> wrote:
>
> > Strange. Seems like the message catalog doing the wrong stuff here.
> >
> > --
> > Jarl
> >
> > On Sat, Mar 29, 2008 at 11:27 PM, Axton <[EMAIL PROTECTED]> wrote:
> > > ** Very odd, it would appear that if the LANG env var is set, the
> > memory
> > > leak happens; if the env var is not set, no leak.
> > >
> > > In the case of the memory leak:
> > > [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
> > >  LANG=en_US.UTF-8
> > > LC_CTYPE="en_US.UTF-8"
> > > LC_NUMERIC="en_US.UTF-8"
> > > LC_TIME="en_US.UTF-8"
> > > LC_COLLATE="en_US.UTF-8"
> > > LC_MONETARY="en_US.UTF-8"
> > > LC_MESSAGES="en_US.UTF-8"
> > >  LC_ALL=
> > >
> > > In the case of no leak:
> > > [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
> > > LANG=
> > > LC_CTYPE="C"
> > > LC_NUMERIC="C"
> > > LC_TIME="C"
> > > LC_COLLATE="C"
> > >  LC_MONETARY="C"
> > > LC_MESSAGES="C"
> > > LC_ALL=
> > >
> > > Axton
> > >
> > >
> > >
> > > On Fri, Mar 28, 2008 at 4:05 PM, Axton <[EMAIL PROTECTED]> wrote:
> > >
> > > > Some add'l info:
> > > >
> > > > (dbx) stop in ARTermination
> > > > dbx: warning: 'ARTermination' has no debugger info -- will trigger
> > on
> > > first instruction
> > > > (2) stop in ARTermination
> > > > (dbx) rerun
> > > > Running: sendrem
> > > > (process id 2990)
> > > >
> > > > RTC: Enabling Error Checking...
> > > > RTC: Running program...
> > > > [EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 
> > > > 0xecdd6968
> > > > 0xecdd6968: ARTermination   :   save %sp, -120, %sp
> > > > Current function is main
> > > >31 rtn = ARTermination (&control, &status);
> > > > (dbx) showleaks
> > > >
> > > > Checking for memory leaks...
> > > >
> > > > Actual leaks report(actual leaks:1  total size:
> >154
> > > bytes)
> > > >
> > > >   Total Num of  Leaked Allocation call stack
> > > >   Size  Blocks  Block
> > > > Address
> > > > ==  == ===
> > ===
> > > >154   10x40388  UNIXInitialization < _pthread_once <
> > > DoARInitialization < ARInitialization < main
> > > >
> > > >
> > > >
> > > > Possible leaks report  (possible leaks:  0  total size:
> >  0
> > > bytes)
> > > >
> > > >
> > > > (dbx) print (char *)0x40388
> > > > (char *) 0x40388 = 0x40388
> > >
> > "NLSPATH=/a/b/c/usr/SUNWspro/bin/../prod/bin/sparcv9/../../lib/locale/en_US.UTF-8/LC_MESSAGES/%N.cat:/usr/lib/locale//LC_MESSAGES/N"
> > > > (dbx) exit
> > > > [EMAIL PROTECTED] scratch

Re: Memory leak in ARInitialization (c api 7.1)

2008-03-30 Thread Wayne Keenan
I'm making an educated guess, based on my experience with other C API's, but
it could just be some table /struct/buffer/scratch space used to support the
locale; which will/has to exist (and potentially not grow) for the duration
of the process?

Not all memory still in use at program end is a 'leak' to be concerned
about, it may be required and should only be free'ed at process exit;
perhaps in this case that cleanup has been forgotten about?

Just a thought.

Regards
Wayne


On Sun, Mar 30, 2008 at 8:21 AM, Jarl Grøneng <[EMAIL PROTECTED]>
wrote:

> Strange. Seems like the message catalog doing the wrong stuff here.
>
> --
> Jarl
>
> On Sat, Mar 29, 2008 at 11:27 PM, Axton <[EMAIL PROTECTED]> wrote:
> > ** Very odd, it would appear that if the LANG env var is set, the memory
> > leak happens; if the env var is not set, no leak.
> >
> > In the case of the memory leak:
> > [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
> >  LANG=en_US.UTF-8
> > LC_CTYPE="en_US.UTF-8"
> > LC_NUMERIC="en_US.UTF-8"
> > LC_TIME="en_US.UTF-8"
> > LC_COLLATE="en_US.UTF-8"
> > LC_MONETARY="en_US.UTF-8"
> > LC_MESSAGES="en_US.UTF-8"
> >  LC_ALL=
> >
> > In the case of no leak:
> > [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
> > LANG=
> > LC_CTYPE="C"
> > LC_NUMERIC="C"
> > LC_TIME="C"
> > LC_COLLATE="C"
> >  LC_MONETARY="C"
> > LC_MESSAGES="C"
> > LC_ALL=
> >
> > Axton
> >
> >
> >
> > On Fri, Mar 28, 2008 at 4:05 PM, Axton <[EMAIL PROTECTED]> wrote:
> >
> > > Some add'l info:
> > >
> > > (dbx) stop in ARTermination
> > > dbx: warning: 'ARTermination' has no debugger info -- will trigger on
> > first instruction
> > > (2) stop in ARTermination
> > > (dbx) rerun
> > > Running: sendrem
> > > (process id 2990)
> > >
> > > RTC: Enabling Error Checking...
> > > RTC: Running program...
> > > [EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 
> > > 0xecdd6968
> > > 0xecdd6968: ARTermination   :   save %sp, -120, %sp
> > > Current function is main
> > >31 rtn = ARTermination (&control, &status);
> > > (dbx) showleaks
> > >
> > > Checking for memory leaks...
> > >
> > > Actual leaks report(actual leaks:1  total size:
>  154
> > bytes)
> > >
> > >   Total Num of  Leaked Allocation call stack
> > >   Size  Blocks  Block
> > > Address
> > > ==  == === ===
> > >154   10x40388  UNIXInitialization < _pthread_once <
> > DoARInitialization < ARInitialization < main
> > >
> > >
> > >
> > > Possible leaks report  (possible leaks:  0  total size:
>0
> > bytes)
> > >
> > >
> > > (dbx) print (char *)0x40388
> > > (char *) 0x40388 = 0x40388
> >
> "NLSPATH=/a/b/c/usr/SUNWspro/bin/../prod/bin/sparcv9/../../lib/locale/en_US.UTF-8/LC_MESSAGES/%N.cat:/usr/lib/locale//LC_MESSAGES/N"
> > > (dbx) exit
> > > [EMAIL PROTECTED] scratch]$ env |grep NLSPATH
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Fri, Mar 28, 2008 at 1:41 PM, Axton <[EMAIL PROTECTED]> wrote:
> > >
> > > > A very simple program (does nothing, really, except create an
> arcontrol
> > struct):
> > > >
> > > > [EMAIL PROTECTED] scratch]$ cat sendrem.c
> > > > #include
> > > > #include
> > > > #include
> > > > #include
> > > >
> > > > int main
> > > > (
> > > >   int argc,
> > > >   char *argv[]
> > > > )
> > > > {
> > > >   ARControlStructcontrol;
> > > >   ARFieldValueList   fieldList;
> > > >   AREntryIdType  entryId;
> > > >   ARStatusList   status;
> > > >   intrtn;
> > > >
> > > >   control.cacheId = 0;
> > > >   control.sessionId = 0;
> > > >   strncpy (control.server, "remedy", AR_MAX_SERVER_SIZE);
> > > >   strncpy (control.user, "Demo", sizeof(ARAccessNameType) - 1);
> > > >   strncpy (control.password, "", sizeof(ARPasswordType) - 1);
> > > >   strncpy (control.authString, "", AR_MAX_AUTH_SIZE);
> > > >   strcpy (control.localeInfo.locale, "");
> > > >   strcpy (control.localeInfo.charSet, "");
> > > >   strcpy (control.localeInfo.timeZone, "");
> > > >   strcpy (control.localeInfo.customDateFormat, "");
> > > >   strcpy (control.localeInfo.customTimeFormat, "");
> > > >   strcpy (control.localeInfo.separators, "");
> > > >
> > > >   rtn = ARInitialization (&control, &status);
> > > >   FreeARStatusList(&status, FALSE);
> > > >
> > > >   rtn = ARTermination (&control, &status);
> > > >   FreeARStatusList(&status, FALSE);
> > > >
> > > >   return 0;
> > > > }
> > > >
> > > >
> > > >
> > > > [EMAIL PROTECTED] scratch]$ cat Makefile
> > > > #
> > > > # parameters
> > > >
> > > > PROGRAM   = sendrem
> > > > SOURCES   = sendrem.c
> > > > OBJECTS   = sendrem.o
> > > > RM= /usr/bin/rm -f
> > > >
> > > > #
> > > > # compiler flags
> > > >
> > > > CC= /a/b/c/usr/SUNWspro/bin/cc
> > > > CXX   = /a/b/c/usr/SUNWspro/bin/CC
> > > > CFLAGS= -D_REENTRANT -g -DDEBUG -v -Xc -xc99=none
> -features=extinl
> > > > CPPFLAGS  = -I../../../lib/

Re: Memory leak in ARInitialization (c api 7.1)

2008-03-30 Thread Jarl Grøneng
Strange. Seems like the message catalog doing the wrong stuff here.

--
Jarl

On Sat, Mar 29, 2008 at 11:27 PM, Axton <[EMAIL PROTECTED]> wrote:
> ** Very odd, it would appear that if the LANG env var is set, the memory
> leak happens; if the env var is not set, no leak.
>
> In the case of the memory leak:
> [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
>  LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
>  LC_ALL=
>
> In the case of no leak:
> [EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
> LANG=
> LC_CTYPE="C"
> LC_NUMERIC="C"
> LC_TIME="C"
> LC_COLLATE="C"
>  LC_MONETARY="C"
> LC_MESSAGES="C"
> LC_ALL=
>
> Axton
>
>
>
> On Fri, Mar 28, 2008 at 4:05 PM, Axton <[EMAIL PROTECTED]> wrote:
>
> > Some add'l info:
> >
> > (dbx) stop in ARTermination
> > dbx: warning: 'ARTermination' has no debugger info -- will trigger on
> first instruction
> > (2) stop in ARTermination
> > (dbx) rerun
> > Running: sendrem
> > (process id 2990)
> >
> > RTC: Enabling Error Checking...
> > RTC: Running program...
> > [EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 0xecdd6968
> > 0xecdd6968: ARTermination   :   save %sp, -120, %sp
> > Current function is main
> >31 rtn = ARTermination (&control, &status);
> > (dbx) showleaks
> >
> > Checking for memory leaks...
> >
> > Actual leaks report(actual leaks:1  total size:154
> bytes)
> >
> >   Total Num of  Leaked Allocation call stack
> >   Size  Blocks  Block
> > Address
> > ==  == === ===
> >154   10x40388  UNIXInitialization < _pthread_once <
> DoARInitialization < ARInitialization < main
> >
> >
> >
> > Possible leaks report  (possible leaks:  0  total size:  0
> bytes)
> >
> >
> > (dbx) print (char *)0x40388
> > (char *) 0x40388 = 0x40388
> "NLSPATH=/a/b/c/usr/SUNWspro/bin/../prod/bin/sparcv9/../../lib/locale/en_US.UTF-8/LC_MESSAGES/%N.cat:/usr/lib/locale//LC_MESSAGES/N"
> > (dbx) exit
> > [EMAIL PROTECTED] scratch]$ env |grep NLSPATH
> >
> >
> >
> >
> >
> >
> > On Fri, Mar 28, 2008 at 1:41 PM, Axton <[EMAIL PROTECTED]> wrote:
> >
> > > A very simple program (does nothing, really, except create an arcontrol
> struct):
> > >
> > > [EMAIL PROTECTED] scratch]$ cat sendrem.c
> > > #include
> > > #include
> > > #include
> > > #include
> > >
> > > int main
> > > (
> > >   int argc,
> > >   char *argv[]
> > > )
> > > {
> > >   ARControlStructcontrol;
> > >   ARFieldValueList   fieldList;
> > >   AREntryIdType  entryId;
> > >   ARStatusList   status;
> > >   intrtn;
> > >
> > >   control.cacheId = 0;
> > >   control.sessionId = 0;
> > >   strncpy (control.server, "remedy", AR_MAX_SERVER_SIZE);
> > >   strncpy (control.user, "Demo", sizeof(ARAccessNameType) - 1);
> > >   strncpy (control.password, "", sizeof(ARPasswordType) - 1);
> > >   strncpy (control.authString, "", AR_MAX_AUTH_SIZE);
> > >   strcpy (control.localeInfo.locale, "");
> > >   strcpy (control.localeInfo.charSet, "");
> > >   strcpy (control.localeInfo.timeZone, "");
> > >   strcpy (control.localeInfo.customDateFormat, "");
> > >   strcpy (control.localeInfo.customTimeFormat, "");
> > >   strcpy (control.localeInfo.separators, "");
> > >
> > >   rtn = ARInitialization (&control, &status);
> > >   FreeARStatusList(&status, FALSE);
> > >
> > >   rtn = ARTermination (&control, &status);
> > >   FreeARStatusList(&status, FALSE);
> > >
> > >   return 0;
> > > }
> > >
> > >
> > >
> > > [EMAIL PROTECTED] scratch]$ cat Makefile
> > > #
> > > # parameters
> > >
> > > PROGRAM   = sendrem
> > > SOURCES   = sendrem.c
> > > OBJECTS   = sendrem.o
> > > RM= /usr/bin/rm -f
> > >
> > > #
> > > # compiler flags
> > >
> > > CC= /a/b/c/usr/SUNWspro/bin/cc
> > > CXX   = /a/b/c/usr/SUNWspro/bin/CC
> > > CFLAGS= -D_REENTRANT -g -DDEBUG -v -Xc -xc99=none -features=extinl
> > > CPPFLAGS  = -I../../../lib/arapi-solaris-701/include -m32
> > > LDFLAGS   = -L../../../lib/arapi-solaris-701/lib
> > > LDLIBS= -lar -Bdynamic -lnsl -lw -lpthread -ldl
> > >
> > > #
> > > # standard targets
> > >
> > > all:$(OBJECTS)
> > > $(CXX) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS) $(LDLIBS)
> > >
> > > clean:
> > > $(RM) $(PROGRAM) $(OBJECTS) core
> > >
> > >
> > >
> > >
> > > Compiles clean:
> > >
> > > [EMAIL PROTECTED] scratch]$ make clean
> > > /usr/bin/rm -f sendrem sendrem.o core
> > > [EMAIL PROTECTED] scratch]$ make
> > > /a/b/c/usr/SUNWspro/bin/cc -D_REENTRANT -g -DDEBUG -v -Xc -xc99=none
> -features=extinl -I../../../lib/arapi-solaris-701/include -m32  -c -o
> sendrem.o sendrem.c
> > > /a/b/c/usr/SUNWspro/bin/CC -o sendrem sendrem.o
> -L../../../lib/arapi-solaris-701/lib -lar -Bdynamic -lnsl -lw -lpthread -ldl
> > >
> > >
> > >
> > > 

Re: Memory leak in ARInitialization (c api 7.1)

2008-03-29 Thread Axton
Very odd, it would appear that if the LANG env var is set, the memory leak
happens; if the env var is not set, no leak.

In the case of the memory leak:
[EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=

In the case of no leak:
[EMAIL PROTECTED] /home/remedy/projects/memleak_arinit]$ locale
LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

Axton

On Fri, Mar 28, 2008 at 4:05 PM, Axton <[EMAIL PROTECTED]> wrote:

> Some add'l info:
>
> (dbx) stop in ARTermination
> dbx: warning: 'ARTermination' has no debugger info -- will trigger on
> first instruction
> (2) stop in ARTermination
> (dbx) rerun
> Running: sendrem
> (process id 2990)
> RTC: Enabling Error Checking...
> RTC: Running program...
> [EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 0xecdd6968
> 0xecdd6968: ARTermination   :   save %sp, -120, %sp
> Current function is main
>31 rtn = ARTermination (&control, &status);
> (dbx) showleaks
> Checking for memory leaks...
>
> Actual leaks report(actual leaks:1  total size:154
> bytes)
>
>   Total Num of  Leaked Allocation call stack
>   Size  Blocks  Block
> Address
> ==  == === ===
>154   10x40388  UNIXInitialization < _pthread_once <
> DoARInitialization < ARInitialization < main
>
>
> Possible leaks report  (possible leaks:  0  total size:  0
> bytes)
>
>
> (dbx) print (char *)0x40388
> (char *) 0x40388 = 0x40388
> "NLSPATH=/a/b/c/usr/SUNWspro/bin/../prod/bin/sparcv9/../../lib/locale/en_US.UTF-8/LC_MESSAGES/%N.cat:/usr/lib/locale//LC_MESSAGES/N"
> (dbx) exit
> [EMAIL PROTECTED] scratch]$ env |grep NLSPATH
>
>
>
> On Fri, Mar 28, 2008 at 1:41 PM, Axton <[EMAIL PROTECTED]> wrote:
>
> > A very simple program (does nothing, really, except create an arcontrol
> > struct):
> >
> > [EMAIL PROTECTED] scratch]$ cat sendrem.c
> > #include
> > #include
> > #include
> > #include
> >
> > int main
> > (
> >   int argc,
> >   char *argv[]
> > )
> > {
> >   ARControlStructcontrol;
> >   ARFieldValueList   fieldList;
> >   AREntryIdType  entryId;
> >   ARStatusList   status;
> >   intrtn;
> >
> >   control.cacheId = 0;
> >   control.sessionId = 0;
> >   strncpy (control.server, "remedy", AR_MAX_SERVER_SIZE);
> >   strncpy (control.user, "Demo", sizeof(ARAccessNameType) - 1);
> >   strncpy (control.password, "", sizeof(ARPasswordType) - 1);
> >   strncpy (control.authString, "", AR_MAX_AUTH_SIZE);
> >   strcpy (control.localeInfo.locale, "");
> >   strcpy (control.localeInfo.charSet, "");
> >   strcpy (control.localeInfo.timeZone, "");
> >   strcpy (control.localeInfo.customDateFormat, "");
> >   strcpy (control.localeInfo.customTimeFormat, "");
> >   strcpy (control.localeInfo.separators, "");
> >
> >   rtn = ARInitialization (&control, &status);
> >   FreeARStatusList(&status, FALSE);
> >
> >   rtn = ARTermination (&control, &status);
> >   FreeARStatusList(&status, FALSE);
> >
> >   return 0;
> > }
> >
> >
> >
> > [EMAIL PROTECTED] scratch]$ cat Makefile
> > #
> > # parameters
> >
> > PROGRAM   = sendrem
> > SOURCES   = sendrem.c
> > OBJECTS   = sendrem.o
> > RM= /usr/bin/rm -f
> >
> > #
> > # compiler flags
> >
> > CC= /a/b/c/usr/SUNWspro/bin/cc
> > CXX   = /a/b/c/usr/SUNWspro/bin/CC
> > CFLAGS= -D_REENTRANT -g -DDEBUG -v -Xc -xc99=none -features=extinl
> > CPPFLAGS  = -I../../../lib/arapi-solaris-701/include -m32
> > LDFLAGS   = -L../../../lib/arapi-solaris-701/lib
> > LDLIBS= -lar -Bdynamic -lnsl -lw -lpthread -ldl
> >
> > #
> > # standard targets
> >
> > all:$(OBJECTS)
> > $(CXX) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS) $(LDLIBS)
> >
> > clean:
> > $(RM) $(PROGRAM) $(OBJECTS) core
> >
> >
> >
> >
> > Compiles clean:
> >
> > [EMAIL PROTECTED] scratch]$ make clean
> > /usr/bin/rm -f sendrem sendrem.o core
> > [EMAIL PROTECTED] scratch]$ make
> > /a/b/c/usr/SUNWspro/bin/cc -D_REENTRANT -g -DDEBUG -v -Xc -xc99=none
> > -features=extinl -I../../../lib/arapi-solaris-701/include -m32  -c -o
> > sendrem.o sendrem.c
> > /a/b/c/usr/SUNWspro/bin/CC -o sendrem 
> > sendrem.o-L../../../lib/arapi-solaris-701/lib -lar -Bdynamic -lnsl -lw 
> > -lpthread -ldl
> >
> >
> >
> > dbx shows a memory leak in ARInitialization:
> >
> > [EMAIL PROTECTED] scratch]$ dbx sendrem
> > For information about new features see `help changes'
> > To remove this message, put `dbxenv suppress_startup_message 7.6' in
> > your .dbxrc
> > Reading sendrem
> > Reading ld.so.1
> > Reading libumem.so.1
> > Reading libar.so
> > Reading libnsl.so.1
> > Reading libw.so.1
> > Reading libpthread.so.1
> > Reading libdl.so.1
> > Reading libCrun.so.1
> > Reading libm.so

Re: Memory leak in ARInitialization (c api 7.1)

2008-03-28 Thread Axton
Some add'l info:

(dbx) stop in ARTermination
dbx: warning: 'ARTermination' has no debugger info -- will trigger on first
instruction
(2) stop in ARTermination
(dbx) rerun
Running: sendrem
(process id 2990)
RTC: Enabling Error Checking...
RTC: Running program...
[EMAIL PROTECTED] ([EMAIL PROTECTED]) stopped in ARTermination at 0xecdd6968
0xecdd6968: ARTermination   :   save %sp, -120, %sp
Current function is main
   31 rtn = ARTermination (&control, &status);
(dbx) showleaks
Checking for memory leaks...

Actual leaks report(actual leaks:1  total size:154
bytes)

  Total Num of  Leaked Allocation call stack
  Size  Blocks  Block
Address
==  == === ===
   154   10x40388  UNIXInitialization < _pthread_once <
DoARInitialization < ARInitialization < main


Possible leaks report  (possible leaks:  0  total size:  0
bytes)


(dbx) print (char *)0x40388
(char *) 0x40388 = 0x40388
"NLSPATH=/a/b/c/usr/SUNWspro/bin/../prod/bin/sparcv9/../../lib/locale/en_US.UTF-8/LC_MESSAGES/%N.cat:/usr/lib/locale//LC_MESSAGES/N"
(dbx) exit
[EMAIL PROTECTED] scratch]$ env |grep NLSPATH


On Fri, Mar 28, 2008 at 1:41 PM, Axton <[EMAIL PROTECTED]> wrote:

> A very simple program (does nothing, really, except create an arcontrol
> struct):
>
> [EMAIL PROTECTED] scratch]$ cat sendrem.c
> #include
> #include
> #include
> #include
>
> int main
> (
>   int argc,
>   char *argv[]
> )
> {
>   ARControlStructcontrol;
>   ARFieldValueList   fieldList;
>   AREntryIdType  entryId;
>   ARStatusList   status;
>   intrtn;
>
>   control.cacheId = 0;
>   control.sessionId = 0;
>   strncpy (control.server, "remedy", AR_MAX_SERVER_SIZE);
>   strncpy (control.user, "Demo", sizeof(ARAccessNameType) - 1);
>   strncpy (control.password, "", sizeof(ARPasswordType) - 1);
>   strncpy (control.authString, "", AR_MAX_AUTH_SIZE);
>   strcpy (control.localeInfo.locale, "");
>   strcpy (control.localeInfo.charSet, "");
>   strcpy (control.localeInfo.timeZone, "");
>   strcpy (control.localeInfo.customDateFormat, "");
>   strcpy (control.localeInfo.customTimeFormat, "");
>   strcpy (control.localeInfo.separators, "");
>
>   rtn = ARInitialization (&control, &status);
>   FreeARStatusList(&status, FALSE);
>
>   rtn = ARTermination (&control, &status);
>   FreeARStatusList(&status, FALSE);
>
>   return 0;
> }
>
>
>
> [EMAIL PROTECTED] scratch]$ cat Makefile
> #
> # parameters
>
> PROGRAM   = sendrem
> SOURCES   = sendrem.c
> OBJECTS   = sendrem.o
> RM= /usr/bin/rm -f
>
> #
> # compiler flags
>
> CC= /a/b/c/usr/SUNWspro/bin/cc
> CXX   = /a/b/c/usr/SUNWspro/bin/CC
> CFLAGS= -D_REENTRANT -g -DDEBUG -v -Xc -xc99=none -features=extinl
> CPPFLAGS  = -I../../../lib/arapi-solaris-701/include -m32
> LDFLAGS   = -L../../../lib/arapi-solaris-701/lib
> LDLIBS= -lar -Bdynamic -lnsl -lw -lpthread -ldl
>
> #
> # standard targets
>
> all:$(OBJECTS)
> $(CXX) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS) $(LDLIBS)
>
> clean:
> $(RM) $(PROGRAM) $(OBJECTS) core
>
>
>
>
> Compiles clean:
>
> [EMAIL PROTECTED] scratch]$ make clean
> /usr/bin/rm -f sendrem sendrem.o core
> [EMAIL PROTECTED] scratch]$ make
> /a/b/c/usr/SUNWspro/bin/cc -D_REENTRANT -g -DDEBUG -v -Xc -xc99=none
> -features=extinl -I../../../lib/arapi-solaris-701/include -m32  -c -o
> sendrem.o sendrem.c
> /a/b/c/usr/SUNWspro/bin/CC -o sendrem 
> sendrem.o-L../../../lib/arapi-solaris-701/lib -lar -Bdynamic -lnsl -lw 
> -lpthread -ldl
>
>
>
> dbx shows a memory leak in ARInitialization:
>
> [EMAIL PROTECTED] scratch]$ dbx sendrem
> For information about new features see `help changes'
> To remove this message, put `dbxenv suppress_startup_message 7.6' in your
> .dbxrc
> Reading sendrem
> Reading ld.so.1
> Reading libumem.so.1
> Reading libar.so
> Reading libnsl.so.1
> Reading libw.so.1
> Reading libpthread.so.1
> Reading libdl.so.1
> Reading libCrun.so.1
> Reading libm.so.1
> Reading libc.so.1
> Reading libicuucbmc.so.32
> Reading libicui18nbmc.so.32
> Reading libicudatabmc.so.32
> Reading libmp.so.2
> Reading libCstd.so.1
> Reading libc_psr.so.1
> Reading libthread.so.1
> Reading libCstd_isa.so.1
> (dbx) check -leaks
> leaks checking - ON
> (dbx) run
> Running: sendrem
> (process id 26476)
> Reading rtcapihook.so
> Reading rtcaudit.so
> Reading libmapmalloc.so.1
> Reading libgen.so.1
> Reading rtcboot.so
> Reading librtc.so
> RTC: Enabling Error Checking...
> RTC: Running program...
> Reading en_US.UTF-8.so.2
> Reading methods_unicode.so.2
> Checking for memory leaks...
>
> Actual leaks report(actual leaks:1  total size:154
> bytes)
>
>   Total Num of  Leaked Allocation call stack
>   Size  Blocks  Block
> Address
> ==  == === ===
>154   10x40450  UNIXInitialization <