Page 1 sur 1
[resolu] Combien de mémoire ?
Publié : sam. 26/juil./2008 17:14
par Ar-S
Salut,
J'ai une autre question en ce samedi soir orageux,
Auriez vous un code permettant de trouver la quantité de mémoire d'un PC ?
Je n'ai rien trouvé ni ici ni sur le fofo us.
Publié : sam. 26/juil./2008 17:51
par Chris
Tu as essayé GlobalMemoryStatus_(@info.MEMORYSTATUS)
La structure existe dans PB, et l'explication de la structure est :
dwLength
Size of the MEMORYSTATUS data structure, in bytes. You do not need to set this member before calling the GlobalMemoryStatus function; the function sets it.
dwMemoryLoad
Number between 0 and 100 that specifies the approximate percentage of physical memory that is in use (0 indicates no memory use and 100 indicates full memory use).
Windows NT: Percentage of approximately the last 1000 pages of physical memory that is in use.
dwTotalPhys
Total size of physical memory, in bytes.
dwAvailPhys
Size of physical memory available, in bytes.
dwTotalPageFile
Size of the committed memory limit, in bytes.
dwAvailPageFile
Size of available memory to commit, in bytes.
dwTotalVirtual
Total size of the user mode portion of the virtual address space of the calling process, in bytes.
dwAvailVirtual
Size of unreserved and uncommitted memory in the user mode portion of the virtual address space of the calling process, in bytes.
Publié : sam. 26/juil./2008 18:26
par Ar-S
Ah super ça, ça marche impeccablement.
Par contre je ne vois pas ou tu as lu ça dans la doc.
Publié : sam. 26/juil./2008 18:36
par Chris
C'est dans le SDK Microsoft.
Sinon, il y a la même en un peu plus évolué : GlobalMemoryStatusEx
http://msdn.microsoft.com/en-us/library/aa366589.aspx
Code : Tout sélectionner
info.MEMORYSTATUSEX
info\dwLength = SizeOf(MEMORYSTATUSEX)
GlobalMemoryStatusEx_(@info)
Debug "Pourcentage de mémoire utilisée : " + Str(info\dwMemoryLoad)+" %"
Debug "Mémoire physique totale : " + Str(info\ullTotalPhys / 1024) + " Ko"
Debug "Mémoire physique libre : " + Str(info\ullAvailPhys / 1024)+ " Ko"
Debug "Fichier d'échange total : " + Str(info\ullTotalPageFile / 1024) + " Ko"
Debug "Fichier d'échange libre : " + Str(info\ullAvailPageFile / 1024) + " Ko"
Debug "Mémoire virtuelle totale : " + Str(info\ullTotalVirtual / 1024) + " Ko"
Debug "Mémoire virtuelle libre : " + Str(info\ullAvailVirtual / 1024) + " Ko"
Debug "Mémoire virtuelle étendue libre : " + Str(info\ullAvailExtendedVirtual / 1024) + " Ko"
Publié : sam. 26/juil./2008 19:37
par cha0s
Au cas ou sa intéresserait quelqu'un sous linux c'est un peut plus simple.
http://man.developpez.com/man1/free.1.php