On Thu, 16 Oct 2008, Szak�ts Viktor wrote:

Hi Viktor,

> What do you think of making the choice
> between stats on or off via a command line
> switch or envvar? Currently both the non-GNU
> and the non-GNU ways or choosing between these
> are cumbersome, and there is no way to turn
> stats on on the field if leakage or corruption
> is suspected.

I can chose them very easy type of FM module during linking
by -fmstat switch, f.e.:

   hbmk mycode.prg -n -w -es2 -fmstat

It works perfectly for me for very long time.

> To make it dynamic, we'd probably need to link
> in both versions with different names (along
> with mem manager), and hb_x*() would need to
> do a jump to the right one based on some
> pre-filled static pointers. I don't know how
> much speed penalty that would give, though.
> If it's not that much, it may be worth the
> extra flexibility in return.

It can be made dynamic but because memory allocation is
activated from startup code then enabling/disabling memory
statistic will have to be done inside hb_xgrab() and hb_xalloc()
when any of this function is called 1-st time by code like

   if( s_fInit )
   {
      [chose FM]  // warning: YOU MUST NOT ACTIVATE MEMORY ALLOCATION IN
                  //          THIS CODE !!!
      s_fInit = FALSE;
   }

executed at the beginning of above functions. Then body of hb_xgrab(),
hb_xalloc(), hb_xrealloc(), hb_xfree() we will have to be changed to
sth like:

   if( s_fmEnabled )
   {
      [....]
   }
   else
   {
      [....]
   }

That's all but I do not know if it's worth to do. For me link time
switch is perfect.

BTW DLMALLOC has it's own memory statistic which is always present.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to