Got an idea for enhancing PureBasic? New command(s) you'd like to see?
			
		
		
			
				
																			
								NikitaOdnorob98 							 
						User 			
		Posts:  74  		Joined:  Fri Jun 29, 2012 4:50 pm 		
		
						
						
		 
		
						
						
													
							
						
									
						Post 
					 
								by NikitaOdnorob98   »  Thu Aug 14, 2014 9:00 am 
			
			
			
			
			Please, add this function
Code: Select all 
Procedure.b TestMemory(*Pointer) ;Only Windows
  Protected mbi.MEMORY_BASIC_INFORMATION
  Protected Result.b = #False, dwWrote
  
  dwWrote = VirtualQuery_(*Pointer, @mbi, SizeOf(MEMORY_BASIC_INFORMATION))
  If dwWrote
    If mbi\BaseAddress+mbi\RegionSize >= *Pointer+1
      If mbi\Protect & (#PAGE_READONLY | #PAGE_READWRITE | #PAGE_EXECUTE_READ | #PAGE_EXECUTE_READWRITE)
        Result = #True
      EndIf
    EndIf
  EndIf
  
  ProcedureReturn Result
EndProcedure
*mem = AllocateMemory(10)
If *mem
  Debug TestMemory(*mem)
  FreeMemory(*mem)
EndIf
*mem = Random(100000) ;Random value
Debug TestMemory(*mem) 
			
			
									
									
						 
		 
				
		
		 
	 
				
			
		
		
			
				
								graph100 							 
						Enthusiast 			
		Posts:  115  		Joined:  Tue Aug 10, 2010 3:17 pm 		
		
						
						
		 
		
						
						
													
							
						
									
						Post 
					 
								by graph100   »  Thu Aug 14, 2014 10:53 am 
			
			
			
			
			it's not reliable.. 1 time over 5 it answers "1 1"
			
			
									
									_________________________________________________
My Website : 
Cerise Code    (Warning : perpetual changes & not completed 
)
 
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								IdeasVacuum 							 
						Always Here 			
		Posts:  6426  		Joined:  Fri Oct 23, 2009 2:33 am 		
		
																Location:  Wales, UK 
							
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by IdeasVacuum   »  Thu Aug 14, 2014 11:07 am 
			
			
			
			
			A random test is of very little value. Tests need to be methodical, cover the entire RAM, mimic application loads, be CPU specific. If you want to test memory Memtest86+: 
http://www.memtest.org/  
			
			
									
									IdeasVacuum 
If it sounds simple, you have not grasped the complexity.