Allocating 256 bytes for every allocation actually isn't wise #63

Open
opened 2024-11-09 23:39:15 +00:00 by lda · 1 comment
Contributor

In a roomwerk session, I've noticed memory usages as high as in the ~2GB. After some digging, I've realised it's #33 just backfiring on me.

As I mentioned in the Matrix room the other day, this adds a lot of memory overhead, because every single allocation (every single call to Malloc() is now 256 bytes bigger, and while that might not seem like a lot, it will certainly add up in large, complex programs like Telodendria. I made a comment on #4 about string interning; I think if we could intern strings so that only one copy is stored in memory, that would be an acceptable alternative here.

An interning solution could be interesting, as noted here. We don't need to be fast at looking up, but we need to be at insertions.

In a `roomwerk` session, I've noticed memory usages as high as in the ~2GB. After some digging, I've realised it's #33 just backfiring on me. > As I mentioned in the Matrix room the other day, this adds a lot of memory overhead, because every single allocation (every single call to Malloc() is now 256 bytes bigger, and while that might not seem like a lot, it will certainly add up in large, complex programs like Telodendria. I made a comment on #4 about string interning; I think if we could intern strings so that only one copy is stored in memory, that would be an acceptable alternative here. An interning solution could be interesting, as noted here. We don't need to be fast at *looking up*, but we need to be at insertions.
Owner

Wow, 2GB is a lot. So much for Telodendria being lightweight, haha. But yeah, I'm not surprised, I kind of figured that PR would cause some problems for us down the road.

I'd say the next step for Cytoplasm should definitely be fixing our string issues. I also want to give some much needed attention to the HTTP server. Once I get through the next semester or two of university, I'm hoping I will have the time to dedicate to these things.

Of course, you're more than welcome to start on it before I get to it, but if you're okay with the memory usage for now in development, we can get things cleaned up before a release.

Wow, 2GB is a lot. So much for Telodendria being *lightweight*, haha. But yeah, I'm not surprised, I kind of figured that PR would cause some problems for us down the road. I'd say the next step for Cytoplasm should definitely be fixing our string issues. I also want to give some much needed attention to the HTTP server. Once I get through the next semester or two of university, I'm hoping I will have the time to dedicate to these things. Of course, you're more than welcome to start on it before I get to it, but if you're okay with the memory usage for now in development, we can get things cleaned up before a release.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Telodendria/Cytoplasm#63
No description provided.