tzload memory leak?

Stephen Eubank eubank at predict.com
Fri Apr 16 23:08:07 UTC 1993


I've been using an application (under SunOS 4.1.3)
which switches time zones frequently.
It has a memory leak which I think I've tracked down to tzload,
which I call via tzset. Since it would hardly be noticeable to anyone
who didn't happen to be using (or abusing) tzset thousands of times,
I wouldn't be surprised if it hadn't been noticed before. On the off
chance that someone out there has encountered it, can you send me
pointers to patches, workarounds, etc.? I can't switch to Solaris yet.

Here are some details:
I profile this code:

#include <time.h>

main()
{
	int i;
	for (i=0; i<100; i++) {
		tzset();
	}
}


and find that malloc is called roughly 400 times, while free is called
roughly 300 times. If I increase the number of iterations in the loop 
tp 1000, the calls to malloc and free go up by a factor of 10. malloc is
being called from calloc, which is being called from allocall, which is
being called from tzload. It looks to me like tzload allocates 4 things
and only frees 3 of them each time it is called. 

Thanks for any help you can give me.

Stephen Eubank
eubank at predict.com



More information about the tz mailing list