-1

I just started a project that has been going on for a few years now. It uses Microsoft's PSAPI interface to obtain memory data. More specifically, we are using GetProcessMemoryInfo().

I started working on it under the assumption that the data we collected was stored in binary notation (i.e a kilobyte is 1024 bytes). But, I noticed that everything already written was under the assumption that the data was in decinal notation (a kilobyte is 1000 bytes). When I asked about it, noone knew which form the data was really in, and so far my Google searches haven't shed any light on this.


Edit: after choosing an answer: So, I just had a misunderstanding about what a byte was in decimal vs binary (e.g. they're the same thing). I'm just surprised noone that I asked here corrected me. Anyways, thanks for clearing it up.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Chrus
  • 31
  • 9
  • 1
    I think you need to be a bit more specific than "PSAPI interface". What specific functions/values are you talking about? – Jerry Coffin Aug 23 '16 at 15:02
  • The `GetProcessMemoryInfo ` seems to report values in bytes. I epxect they do not use the "decimal notation" since using the binary one is straightforward. Maybe a tool you use to look at the process memory counters misinterprets the data a little bit. – Martin Drab Aug 23 '16 at 15:14
  • The function appears to be fully, unambiguously and authoritatively documented at the link you have given. What don't you understand about it? – Mike Kinghan Aug 23 '16 at 15:15
  • The term 'byte' is ambiguous. This question explains my confusion: [link](http://stackoverflow.com/questions/19819763/really-1-kb-kilobyte-equals-1024-bytes). The size of a byte is different depending on whether you are using decimal or binary notation. – Chrus Aug 23 '16 at 15:22
  • 2
    The term byte is unambiguous. It is 8 bits, 8 binary digits. – David Heffernan Aug 23 '16 at 15:26

1 Answers1

1

This API returns numbers of bytes. In other words, the question is based on the false premise that values are returned in kilobytes. The distinction you refer to between binary and decimal quantities applies to kilobytes, megabytes, gigabytes etc. It is a meaningless distinction for bytes.

Documentation can be found here:

You will see members of these structures described like this:

PeakWorkingSetSize

The peak working set size, in bytes.

I've only included one example, but they are all of the same form.

Now, if you choose to present these values as kilobytes, or megabytes, or whatever, you have freedom to use whatever definition you choose.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490