Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Question on 'number of buckets in a subsection calculation' in Memory allocator customization doc

Discussion in 'Documentation' started by visca_c, Jan 26, 2023.

  1. visca_c

    visca_c

    Joined:
    Apr 7, 2014
    Posts:
    30
    Doc link: https://docs.unity3d.com/Manual/memory-allocator-customization.html

    under Bucket Allocator section, there is a paragraph that talks about calculating number of buckets in a subsection:
    upload_2023-1-26_11-32-9.png

    When I try to do the math, the numbers don't seem to be exact.

    E.G:
    16KB / 64B = 16000B / 64B = 250
    16KB / 16B = 16000B / 16B = 1000

    the numbers don't seem to line up with the documentation, I wonder what's the underneath reason, if anyone knows, I'd appreciate the info!
     
  2. That's not 16,000 bytes, that's 16,384 bytes. In Computer Science we have the kilobyte defined as 1024 bytes for a long time. I know there are some efforts to change that, but it's dumb and leads to misunderstandings like this.
     
    visca_c likes this.
  3. visca_c

    visca_c

    Joined:
    Apr 7, 2014
    Posts:
    30
    Ah, that make sense now. I did a quick google for 'kb to bytes' and saw the conversion window says '1 kilobyte = 1000 byte', and didn't look further (which I probably should have...)

    Thanks alot for the help!