Page 1 of 1

libharbour.dll virtual machine activity on dbwin32

PostPosted: Sat Oct 23, 2021 2:33 pm
by Antonio Linares

Re: libharbour.dll virtual machine activity on dbwin32

PostPosted: Sun Oct 24, 2021 4:39 pm
by Carles
Mr. Linares,

Incredible the calls that are made to hb_xbfree.

C.

Re: libharbour.dll virtual machine activity on dbwin32

PostPosted: Sun Oct 24, 2021 4:46 pm
by Otto
Dear Antonio,
Can you please explain what these tests are about?
Best regards,
Otto

Re: libharbour.dll virtual machine activity on dbwin32

PostPosted: Mon Oct 25, 2021 8:57 am
by Antonio Linares
Dear Otto,

we have found that building Harbour with these flags:

set HB_USER_CFLAGS=-DHB_FM_STATISTICS_OFF -DHB_FM_WIN_ALLOC

the resulting libharbour.dll manages memory much better, as we use the standard Windows API LocalAlloc(), LocalRealloc(), LocalFree(), etc to manage the memory on Windows

Also, modifying mod_harbour's entry.c this way (two calls to OutputDebugString()) makes memory liberation work much better:
Code: Select all  Expand view
#include <Windows.h>
#include <hbapi.h>
#include <hbvm.h>

static void * pRequestRec;

HB_EXPORT_ATTR int hb_apache( void * _pRequestRec )
{
   int iResult;

   pRequestRec = _pRequestRec;
 
   hb_vmInit( HB_TRUE );
   OutputDebugString( "after hb_vmInit()\n" );
   iResult = hb_vmQuit();
   OutputDebugString( "after hb_vmQuit()\n" );
   return iResult;
}  

void * GetRequestRec( void )
{
   return pRequestRec;
}

HB_FUNC( AP_ENTRY )
{
   hb_apache( NULL );
}