# Can typed racket be used to decrease memory usage?

**URL:** <https://racket.discourse.group/t/can-typed-racket-be-used-to-decrease-memory-usage/3946>\
**Category:** Questions & Answers\
**Created:** [September 20, 2025, 1:07pm UTC](https://racket.discourse.group/t/can-typed-racket-be-used-to-decrease-memory-usage/3946 "2025-09-20T13:07:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sora22](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/sora22/32/2622_2.png) [@sora22](https://racket.discourse.group/u/sora22)\
**Post date:** [September 20, 2025, 1:07pm UTC](https://racket.discourse.group/t/can-typed-racket-be-used-to-decrease-memory-usage/3946/1 "2025-09-20T13:07:56Z")

</div>

I'm trying to reduce the memory usage of a tool I'm helping to develop, and was wondering if typed racket could help me? The example I had in mind was a vector of type (Mutable-Vectorof Byte). Does typed racket only guarantee that the runtime value will be between 0 and 255 or does it also guarantee that each element of the vector will only take a byte of memory?

---

<div class="post-metadata">

**Author:** ![gus-massa](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gus-massa/32/507_2.png) [@gus-massa](https://racket.discourse.group/u/gus-massa)\
**Post date:** [September 20, 2025, 4:27pm UTC](https://racket.discourse.group/t/can-typed-racket-be-used-to-decrease-memory-usage/3946/2 "2025-09-20T16:27:50Z")

</div>

I think you should use [bytes](https://docs.racket-lang.org/reference/bytestrings.html) instead that does what you want.

---

<div class="post-metadata">

**Author:** ![sora22](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/sora22/32/2622_2.png) [@sora22](https://racket.discourse.group/u/sora22)\
**Post date:** [September 20, 2025, 9:25pm UTC](https://racket.discourse.group/t/can-typed-racket-be-used-to-decrease-memory-usage/3946/3 "2025-09-20T21:25:09Z")

</div>

Do byte strings have a guarantee each element will only take a byte of memory? I will try this out, this looks like its exactly what I was looking for, thank you

I am still curious about whether typed racket only provides guarantees for runtime values or can also reduce the memory footprint of a program though

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [September 23, 2025, 3:24pm UTC](https://racket.discourse.group/t/can-typed-racket-be-used-to-decrease-memory-usage/3946/4 "2025-09-23T15:24:02Z")

</div>

Typed Racket does not change the representation of data to use less memory.
