Does Microsoft psapi methods return bytes using decimal or binary notation?

101 views Asked by At

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.

1

There are 1 answers

0
David Heffernan On BEST ANSWER

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.