コード例 #1
0
	virtual void Execute(LPCSTR args) {
		Memory.mem_compact		();
		u32		_crt_heap		= mem_usage_impl((HANDLE)_get_heap_handle(),0,0);
		u32		_process_heap	= mem_usage_impl(GetProcessHeap(),0,0);
#ifdef SEVERAL_ALLOCATORS
		u32		_game_lua		= game_lua_memory_usage();
		u32		_engine_lua		= engine_lua_memory_usage();
		u32		_render			= ::Render->memory_usage();
#endif // SEVERAL_ALLOCATORS
		int		_eco_strings	= (int)g_pStringContainer->stat_economy			();
		int		_eco_smem		= (int)g_pSharedMemoryContainer->stat_economy	();
		u32		m_base=0,c_base=0,m_lmaps=0,c_lmaps=0;
		
		if (Device.Resources)	Device.Resources->_GetMemoryUsage	(m_base,c_base,m_lmaps,c_lmaps);
		
		log_vminfo	();
		
		Msg		("* [ D3D ]: textures[%d K]", (m_base+m_lmaps)/1024);

#ifndef SEVERAL_ALLOCATORS
		Msg		("* [x-ray]: crt heap[%d K], process heap[%d K]",_crt_heap/1024,_process_heap/1024);
#else // SEVERAL_ALLOCATORS
		Msg		("* [x-ray]: crt heap[%d K], process heap[%d K], game lua[%d K], engine lua[%d K], render[%d K]",_crt_heap/1024,_process_heap/1024,_game_lua/1024,_engine_lua/1024,_render/1024);
#endif // SEVERAL_ALLOCATORS

		Msg		("* [x-ray]: economy: strings[%d K], smem[%d K]",_eco_strings/1024,_eco_smem);

#ifdef DEBUG
		Msg		("* [x-ray]: file mapping: memory[%d K], count[%d]",g_file_mapped_memory/1024,g_file_mapped_count);
		dump_file_mappings	();
#endif // DEBUG
	}
コード例 #2
0
ファイル: Berkelium.cpp プロジェクト: KerwinMa/berkelium
void SetupCRT(const CommandLine& parsed_command_line) {
#if defined(OS_WIN)
#ifdef _CRTDBG_MAP_ALLOC
  _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
#else
  if (!parsed_command_line.HasSwitch(switches::kDisableBreakpad)) {
    _CrtSetReportMode(_CRT_ASSERT, 0);
  }
#endif

  // Enable the low fragmentation heap for the CRT heap. The heap is not changed
  // if the process is run under the debugger is enabled or if certain gflags
  // are set.
  bool use_lfh = false;
  if (parsed_command_line.HasSwitch(switches::kUseLowFragHeapCrt))
    use_lfh = parsed_command_line.GetSwitchValue(switches::kUseLowFragHeapCrt)
        != L"false";
  if (use_lfh) {
    void* crt_heap = reinterpret_cast<void*>(_get_heap_handle());
    ULONG enable_lfh = 2;
    HeapSetInformation(crt_heap, HeapCompatibilityInformation,
                       &enable_lfh, sizeof(enable_lfh));
  }
#endif
}
コード例 #3
0
ファイル: heap.c プロジェクト: Kobey1/dprofiler
ULONG
BtrInitializeHeap(
	VOID	
	) 
{
	ULONG Flag = 2;
 
	//
	// Get private crt heap handle
	//

	MmHeapHandle = (HANDLE)_get_heap_handle();
    HeapSetInformation(MmHeapHandle, HeapCompatibilityInformation, 
		               &Flag, sizeof(Flag));

	return S_OK;
}
コード例 #4
0
ファイル: xrCore.cpp プロジェクト: OLR-xray/OLR-3.0
void xrCore::_initialize	(LPCSTR _ApplicationName, LogCallback cb, BOOL init_fs, LPCSTR fs_fname)
{
	strcpy_s					(ApplicationName,_ApplicationName);
	if (0==init_counter) {
#ifdef XRCORE_STATIC	
		_clear87	();
		_control87	( _PC_53,   MCW_PC );
		_control87	( _RC_CHOP, MCW_RC );
		_control87	( _RC_NEAR, MCW_RC );
		_control87	( _MCW_EM,  MCW_EM );
#endif
		// Init COM so we can use CoCreateInstance
//		HRESULT co_res = 
			CoInitializeEx (NULL, COINIT_MULTITHREADED);

		strcpy_s			(Params,sizeof(Params),GetCommandLine());
		_strlwr_s			(Params,sizeof(Params));

		string_path		fn,dr,di;

		// application path
        GetModuleFileName(GetModuleHandle(MODULE_NAME),fn,sizeof(fn));
        _splitpath		(fn,dr,di,0,0);
        strconcat		(sizeof(ApplicationPath),ApplicationPath,dr,di);
#ifndef _EDITOR
		strcpy_s		(g_application_path,sizeof(g_application_path),ApplicationPath);
#endif

		// working path
        if( strstr(Params,"-wf") )
        {
            string_path				c_name;
            sscanf					(strstr(Core.Params,"-wf ")+4,"%[^ ] ",c_name);
            SetCurrentDirectory     (c_name);

        }
		GetCurrentDirectory(sizeof(WorkingPath),WorkingPath);
		// User/Comp Name
		DWORD	sz_user		= sizeof(UserName);
		GetUserName			(UserName,&sz_user);

		DWORD	sz_comp		= sizeof(CompName);
		GetComputerName		(CompName,&sz_comp);

		// Mathematics & PSI detection
		CPU::Detect			();
		
		Memory._initialize	(strstr(Params,"-mem_debug") ? TRUE : FALSE);
		
		DUMP_PHASE;

		InitLog				();
		_initialize_cpu		();

#ifdef DEBUG
	#ifndef DEDICATED_SERVER
		Debug._initialize	(FALSE);
	#else
		Debug._initialize	(TRUE);
	#endif
#endif
		rtc_initialize		();

		xr_FS				= xr_new<CLocatorAPI>	();

		xr_EFS				= xr_new<EFS_Utils>		();
//.		R_ASSERT			(co_res==S_OK);
	}
	if (init_fs){
		u32 flags			= 0;
		if (0!=strstr(Params,"-build"))	 flags |= CLocatorAPI::flBuildCopy;
		if (0!=strstr(Params,"-ebuild")) flags |= CLocatorAPI::flBuildCopy|CLocatorAPI::flEBuildCopy;
#ifdef DEBUG
		if (strstr(Params,"-cache"))  flags |= CLocatorAPI::flCacheFiles;
		else flags &= ~CLocatorAPI::flCacheFiles;
#endif // DEBUG
#ifdef _EDITOR // for EDITORS - no cache
		flags 				&=~ CLocatorAPI::flCacheFiles;
#endif // _EDITOR
		flags |= CLocatorAPI::flScanAppRoot;

#ifndef	_EDITOR
	#ifndef ELocatorAPIH
		if (0!=strstr(Params,"-file_activity"))	 flags |= CLocatorAPI::flDumpFileActivity;
	#endif
#endif
		FS._initialize		(flags,0,fs_fname);
		Msg					("'%s' build %d, %s\n","xrCore",build_id, build_date);
		EFS._initialize		();
#ifdef DEBUG
    #ifndef	_EDITOR
		Msg					("CRT heap 0x%08x",_get_heap_handle());
		Msg					("Process heap 0x%08x",GetProcessHeap());
    #endif
#endif // DEBUG
	}
	
	SetLogCB				(cb);

	LPAPI_VERSION ver = ImagehlpApiVersion();
	if ( NULL == GetProcAddress ( GetModuleHandle("dbghelp.dll"), "EnumerateLoadedModulesEx") )
	{
		string256 msg;		
		DWORD dwVer[2];
		WORD *v4 = (WORD*) &dwVer;
		CSymbolEngine SE;
		SE.GetInMemoryFileVersion("dbghelp.dll", dwVer[0], dwVer[1]);

		sprintf_s(msg, 256, "”старевший файл dbghelp.dll (%d.%d.%d.%d), его рекомендуетс¤ удалить.", 
								v4[1], v4[0], v4[3], v4[2]);
		MessageBox(NULL, msg, "DebugHlp Warning", MB_OK);
	}

	init_counter++;
}
コード例 #5
0
ファイル: rpsFoundation.cpp プロジェクト: AlphaUnity/scribble
void  rpsFree(void *p)
{
    vaHeapFree((HANDLE)_get_heap_handle(), 0, p);
}
コード例 #6
0
ファイル: rpsFoundation.cpp プロジェクト: AlphaUnity/scribble
void* rpsMalloc(size_t s)
{
    return vaHeapAlloc((HANDLE)_get_heap_handle(), 0, s);
}
コード例 #7
0
	Win32GlobalHeapAllocator::Win32GlobalHeapAllocator( const Win32GlobalHeapAllocator& allocator ) : Detail::Win32HeapAllocatorBase( reinterpret_cast<HANDLE>( _get_heap_handle() ), allocator.GetName() ) {}
コード例 #8
0
	Win32GlobalHeapAllocator::Win32GlobalHeapAllocator( const Utf8Char* const name ) : Detail::Win32HeapAllocatorBase( reinterpret_cast<HANDLE>(_get_heap_handle()), name ) {}
コード例 #9
0
ファイル: sysutils.cpp プロジェクト: landswellsong/FAR
void enable_lfh() {
  ULONG heap_info = 2;
  HeapSetInformation(reinterpret_cast<HANDLE>(_get_heap_handle()), HeapCompatibilityInformation, &heap_info, sizeof(heap_info));
}