Copy filename into preallocated field with Cytoplasm's Memory API #33

Merged
jordan merged 2 commits from lda/Cytoplasm:direct-filenames into master 2024-08-18 23:26:20 +00:00
Contributor

This exists because there does exist scenarios where a const char * may be invalidated during, for example, a memory leak report(especially when shared libraries are involved).

This exists because there **does** exist scenarios where a `const char *` may be invalidated during, for example, a memory leak report(especially when shared libraries are involved).
lda added 1 commit 2024-05-26 20:04:12 +00:00
lda changed title from Copy filename into preallocated field with Cytoplasm's Memory API to WIP: Copy filename into preallocated field with Cytoplasm's Memory API 2024-05-26 20:04:31 +00:00
lda added 1 commit 2024-05-26 20:07:01 +00:00
lda changed title from WIP: Copy filename into preallocated field with Cytoplasm's Memory API to Copy filename into preallocated field with Cytoplasm's Memory API 2024-05-26 20:07:15 +00:00
Owner

The logic and the code is sound, but I do have some concerns with the memory footprint this is going to add. Now every single allocation is 256 bytes bigger? I’ll have to think about how I want to approach this.

The logic and the code is sound, but I do have some concerns with the memory footprint this is going to add. Now every single allocation is 256 bytes bigger? I’ll have to think about how I want to approach this.
Owner

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.

I'm not exactly sure how to go about this, but I'm going to think about it for a little.

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. I'm not exactly sure how to go about this, but I'm going to think about it for a little.
Owner

After further consideration, this is probably fine. If people complain that Cytoplasm uses too much memory, we can re-evaluate, but I'm okay with this for now.

After further consideration, this is probably fine. If people complain that Cytoplasm uses too much memory, we can re-evaluate, but I'm okay with this for now.
jordan merged commit 39c25e5a17 into master 2024-08-18 23:26:20 +00:00
Sign in to join this conversation.
No reviewers
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#33
No description provided.