this post was submitted on 21 May 2025
4 points (100.0% liked)

Programming

0 readers
1 users here now

A magazine created for the discussion of computer programming-related topics.

Rules

Please keep submissions on topic and of high quality. No image posts, no memes, no politics. Keep the magazine focused on programming topics not general computing topics. Direct links to app demos (unrelated to programming) will be removed. No surveys.

founded 2 years ago
MODERATORS
 

Deliberately not calling API functions that you're supposed to.

To gain speed at application exit.

I'm just dumbfounded by this. What the actual frick?

https://github.com/tukaani-project/xz/blob/dbfb925c8198087afb3527e6c57b66fae1a980bb/src/xz/main.c#L342

https://github.com/tukaani-project/xz/blob/dbfb925c8198087afb3527e6c57b66fae1a980bb/src/xzdec/xzdec.c#L482

This all is fine and dandy if your library is guaranteed to link to libc malloc that gets released at app exit. But this is assuming quite a bit about how shared libraries work. Not every platform has linkage like this in both ways. Ours doesn't and as a result XZ utilities leak memory on every invocation. It would be fine if the API would be used correctly, but the XZ utilities themselves opt out from calling the lzma_end() function "to be faster" at application exit. You'd think the authors would realize that this is not very speed critical, esp since you've just spent millions cycles more compressing or decompressing.

#dailywtf #development #programming

top 1 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 month ago

Here's the more constructive part of the (I still think warranted - but likely a bit tone deaf) rant: https://github.com/tukaani-project/xz/pull/181