A very simple program (does nothing, really, except create an arcontrol
struct):
[EMAIL PROTECTED] scratch]$ cat sendrem.c
#include <string.h>
#include <ar.h>
#include <arextern.h>
#include <arfree.h>
int main
(
int argc,
char *argv[]
)
{
ARControlStruct control;
ARFieldValueList fieldList;
AREntryIdType entryId;
ARStatusList status;
int rtn;
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 1 0x40450 UNIXInitialization < _pthread_once <
DoARInitialization < ARInitialization < main
Possible leaks report (possible leaks: 0 total size: 0
bytes)
execution completed, exit code is 0
ARServer is non-existent. Same leak shown with both 7.0.1p6 and 7.1p1 c
api.
Some special env vars are set:
LD_PRELOAD=libumem.so.1
UMEM_DEBUG=default
UMEM_LOGGING=transaction
Any insight would be appreciated.
OS: SunOS 5.9 Generic_122300-13 sun4u sparc SUNW,Sun-Fire-480R
Thanks,
Axton Grams
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"