Thank you Przemek. I've tried your suggestion but my implementation
does not work as expected, the stats output is:
fm.c:1134: HB_TR_ERROR Block 1 (size 40) HB_BTREEINSERT(0),
"F8A454004001550058D
C4B00010001001000000000000000000000000000F03F0A00020000000000"
But I know the memory allocation is in a sub-function.
My implementation is different from yours but keeps the spirit. I added
some debug code not shown below so I know it is compiling this code and
executing it. My system is:
WinXP SP2
MinGW32 from Qt installer
HB_USER_CFLAGS to compile harbour:
-O3 -Wall -Wunused-variable -Wpointer-arith -DHB_FM_STATISTICS
HB_USER_CFLAGS to compile this project:
-O3 -Wall -Wunused-variable -Wpointer-arith -DHB_FM_STATISTICS
-DHB_TR_LEVEL=5
My existing code already uses a local function to memory allocation, a
wrapper for hb_xgrab() or hb_xrealloc().
#if HB_TR_LEVEL >= HB_TR_DEBUG
#define BufferAlloc(n) hb_xgrab_fm( NULL, (n), __FILE__, __LINE__ )
#define BufferRealloc(p,n) hb_xgrab_fm( (p), (n), __FILE__, __LINE__ )
extern HB_EXPORT void * hb_xgrab_fm( void *buffer, ULONG ulSize, const
char * szFile, int iLine )
{
void *tmpBuffer;
hb_tr_file_ = szFile;
hb_tr_line_ = iLine;
tmpBuffer = buffer ? hb_xrealloc( buffer, ulSize ) : hb_xgrab( ulSize );
return tmpBuffer;
}
#else
...
#endif
--
Without facts, the decision cannot be made logically. You must rely on your
human intuition.
- Spock, 'Assignment: Earth', stardate unknown
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour