C6333
uyarı C6333: Geçersiz parametre: <function> MEM_RELEASE ve sıfır olmayan dwSize parametresi iletimine izin verilmez.Bu sonuçlar bu aramanın hatalarıdır
Bu uyarı, VirtualFree veya VirtualFreeEx için geçersiz bir parametre geçirildiğini gösterir.Bu işlevlerden her ikisi de dwSize'ın non-zero ile MEM_RELEASE tipini reddeder.MEM_RELEASE geçilirken, dwSize parametresi sıfır olmalıdır.Ayrıca, bu işlevin dönüş değerinin yok sayılmadığından emin olun.
Örnek
Aşağıdaki örnek kod bu uyarıyı oluşturur:
#include <windows.h>
#define PAGELIMIT 80
DWORD dwPages = 0; // count of pages
DWORD dwPageSize; // page size
VOID f( VOID )
{
LPVOID lpvBase; // base address of the test memory
BOOL bSuccess;
SYSTEM_INFO sSysInfo; // system information
GetSystemInfo( &sSysInfo );
dwPageSize = sSysInfo.dwPageSize;
// Reserve pages in the process's virtual address space
lpvBase = VirtualAlloc(
NULL, // system selects address
PAGELIMIT*dwPageSize,// size of allocation
MEM_RESERVE,
PAGE_NOACCESS );
if (lpvBase)
{
// code to access memory
}
else
{
return;
}
bSuccess = VirtualFree(lpvBase, PAGELIMIT * dwPageSize, MEM_RELEASE);
//code...
}
Bu uyarıyı düzeltmek için aşağıdaki örnek kodu kullanın:
#include <windows.h>
#define PAGELIMIT 80
DWORD dwPages = 0; // count of pages
DWORD dwPageSize; // page size
VOID f( VOID )
{
LPVOID lpvBase; // base address of the test memory
BOOL bSuccess;
SYSTEM_INFO sSysInfo; // system information
GetSystemInfo( &sSysInfo );
dwPageSize = sSysInfo.dwPageSize;
// Reserve pages in the process's virtual address space
lpvBase = VirtualAlloc(
NULL, // system selects address
PAGELIMIT*dwPageSize,// size of allocation
MEM_RESERVE,
PAGE_NOACCESS );
if (lpvBase)
{
// code to access memory
}
else
{
return;
}
bSuccess = VirtualFree(lpvBase, 0, MEM_RELEASE );
// VirtualFree(lpvBase, PAGELIMIT * dwPageSize, MEM_DECOMMIT);
// code...
}
Sayfaları kaydetmek için, ve daha sonra MEM_RELEASE bayrakları kullanarak onları serbest bırakmak için VirtualFree(lpvBase, PAGELIMIT * dwPageSize, MEM_DECOMMIT) de kullanabilirsiniz.