Stats:GetTotalMemoryUsageMb Megabit or Megabyte?

https://developer.roblox.com/en-us/api-reference/class/Stats
https://developer.roblox.com/en-us/api-reference/function/Stats/GetTotalMemoryUsageMb

image

So is it Megabit or Megabyte?

1 Like

From what I can tell from the description and the correct abbreviation in-game, it is most likely megabyte.

It is also notable that there are 8 megabits in a megabyte.

The text is written this way for readibility purposes. To a Roblox developer, this title would be way more pleasant to the human eye rather than having GetToalMemoryUsageMB

(post marked for deletion for privacy reasons)

1 Like

It’s probably to follow a naming convention. For example, HttpService isn’t written “HTTPService”. They should probably fix this case though

5 Likes

That’s very counter intuitive and misleading.

MB and Mb are very different they are not interchangeable. Shouldn’t communicating effectively be priorities over “making it pleasant” to read?

I don’t think it has anything to do with being “pleasant to the eye”, rather a guideline for API to use PascalCase for individual terms in the API.

Not sure I understand the problem – API description is pretty clear (“megabytes”) and the developer console also says MB? So in other words, wherever it is displayed, they’re doing it right, it’s just the actual API signature not being “MB”, but it has a clear description.

Additionally you generally don’t use mega"bit" to describe device memory usage. You typically only use megabit when talking about memory transfer speed.

5 Likes

the problem is it’s inconsistent, and this problem isn’t unique to only this either.

https://developer.roblox.com/en-us/api-reference/property/Stats/DataReceiveKbps

https://developer.roblox.com/en-us/api-reference/property/Stats/DataSendKbps

https://developer.roblox.com/en-us/api-reference/property/Stats/PhysicsReceiveKbps
https://developer.roblox.com/en-us/api-reference/property/Stats/PhysicsSendKbps

now I don’t even know what or who to trust for accurate information on this, afaik DevHub is / was managed by the community and not engineers?

the API signature and documentation is contradicting each other which should NEVER happen as it’s misleading and causes confusion.

Imagine a new developer uses one of these methods and assumes that it’s Mb and Kbps instead of the actual unit, that would cause a lot of issues wouldn’t it?

I don’t see how it’s inconsistent? The casing in the signatures is definitely consistent here. Apparently they only allow capitalization of the first letter in each term in the signature. The description has a clear definition of what it returns.

Probably what they should have done in hindsight is not have the unit of measurement in the API signature at all.

2 Likes

Clearly communicating what the function does by using just it’s name should be the goal of any good function name

returning the Unit is important otherwise we wouldn’t know at first glance what unit it’s returning.

using Mb when it actually returns MB is very misleading, a lot of people will automatically assume that the API signature is correct and this may cause issues

and hypothetically if there are two methods, one returns MB and one returns Mb now there is a big problem if they are named them the same.


@sjr04

it’s not really an issue with HTTPService because it doesn’t matter if it’s HTTP, Http, HtTp, HttP it’s the same thing it’s not a unit of measurement

You can turn this issue around the other direction. If the API actually returned Mb instead of MB, because Roblox API is always PascalCase you may incorrectly assume it is MB instead of Mb.

The only correct takeaway here is that you should read the documentation, or intellisense should tell you directly in the script editor. There is no other correct way to name this API to avoid confusion other than outright removing the unit and forcing people to read the documentation.


Also important to note, if you know what a megabit is, you probably know they’re really only used in networking and would be entirely irrelevant to this API…

5 Likes

It’s megabytes, as described on the page. This is just a result of the pascal case naming convention affecting the abbreviation of the unit name, which I agree with @buildthomas should really not be in the signature at all. I also like @PeZsmistic’s point about how the reverse interpretation could also be valid. The best thing we can do is have the function accurately described on page, which as far as I know we do have. Maybe a clarification is in order.

The DevHub is 100% maintained by Roblox employees right now, although a small portion of content was at one point based on the now-defunct wiki, which was partially community-written. Nowadays all of that content has been moved, rewritten, removed, or its original authors hired by the team (howdy there). At the moment, a separate team works with engineers to author content, although a long-term goal is for content to be written by engineers.

5 Likes