Hello Everybody

As I posted ( Toninho too ) about memProof.exe' report 
of unfreed memory pages at appln termination,
here are the investigations.

I used following debugging code:

/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
static void* win32direct_mmap(size_t size) {
  void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
                           PAGE_READWRITE);
OutputDebugString( "--------------------VirtualAllocate  win32direct_mmap"
);
  return (ptr != 0)? ptr: MFAIL;
}

/* This function supports releasing coalesed segments */
static int win32munmap(void* ptr, size_t size) {
  MEMORY_BASIC_INFORMATION minfo;
  BOOL bFail;
  char* cptr = (char*)ptr; /* NOTE: Harbour fix for MSVC C++ mode compile
error. Also fixed in dlmalloc 2.8.4b. [vszakats] */
  while (size) {
    if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
      return -1;
    if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr ||
        minfo.State != MEM_COMMIT || minfo.RegionSize > size)
      return -1;
    bFail = (VirtualFree(cptr, 0, MEM_RELEASE) == 0);
    if (!bFail)
    {
OutputDebugString( "--------------------------------VirtualFree 
(VirtualFree(cptr, 0, MEM_RELEASE) == 0);" );
    }
    else
    {
OutputDebugString( "------------------------------------------VirtualFree 
failed" );
      return -1;
    }
    cptr += minfo.RegionSize;
    size -= minfo.RegionSize;
  }
  return 0;
}

VirtualAlloc() calls == 88
VistualFree() calls == 61  ( all succeeding )
Uncalled allocations == 27
MemProof's reporting == 23 + one entry of 4 allocns of 4096 bytes.

Just food for the thoughts. 
Honestly I do not know what it is and what it should.
But MemProof's report must be considered.

Regards
Pritpal Bedi
-- 
View this message in context: 
http://www.nabble.com/Dlmalloc.c---VirtualAlloc-Free---Test-Results-tp22143106p22143106.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

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

Reply via email to