In ui or server commands, I guess atleast 1 instance of fossil keeps running, 
listening to the port. If that functionality has memory leak, it needs a fix.


> ----- Original Message -----
> From: Richard Hipp
> Sent: 02/16/12 06:04 PM
> To: slonik...@gmail.com, Fossil SCM user's discussion
> Subject: Re: [fossil-users] memory leak using fossil_getenv and       
> fossil_mbcs_to_utf8
> 
> On Thu, Feb 16, 2012 at 6:37 AM, Leo Razoumov <slonik...@gmail.com> wrote:
> 
> > Very recently fossil_getenv function was introduced as a wrapper
> > around standard getenv to get Unicode right.
> > In file.c:
> >
> > /*
> > ** Return the value of an environment variable as UTF8.
> > */
> > char *fossil_getenv(const char *zName){
> >  char *zValue = getenv(zName);
> > #ifdef _WIN32
> >  if( zValue ) zValue = fossil_mbcs_to_utf8(zValue);
> > #endif
> >  return zValue;
> > }
> >
> > In Unix it returns pointer pointing into actual environment (should
> > not be modified or deallocated). In Windows, on the other hand,
> > fossil_mbcs_to_utf8 allocates memory via sqlite3_malloc. This memory
> > is not and cannot not be freed because of UNIX behavior.
> > It results in memory leak on Windows. Should one care?
> >
> 
> No, one should not care.
> 
> Recall that the processing model for Fossil is that each invocation does
> one operation then quits, allowing the operating system to clean up
> afterwards.  (The OS is your garbage collector.)  It is important to free
> memory that is allocated in a loop or that might be allocated multiple
> times based on the size of your repository or the nature of your request.
> However, for things like getenv() which are only called a small number of
> times, a finite number of times, and which don't use much memory to begin
> with, trying to keep track of when to free things merely increases the code
> complexity and risks introducing new bugs.
> 
> 
> 
> >
> > --Leo--
> > _______________________________________________
> > fossil-users mailing list
> > fossil-users@lists.fossil-scm.org
> > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
> >
> 
> 
> 
> -- 
> D. Richard Hipp
> d...@sqlite.org
> 

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to