TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Fixing a memory leak of xmlEntityPtr in librsvg

44 pointsby JNRowe11 months ago

4 comments

PiRho314111 months ago
Was curious if Chat GPT would be able to find the problem if I told it that there was a memory leak which it was able to find.<p><a href="https:&#x2F;&#x2F;chatgpt.com&#x2F;share&#x2F;70af56e3-2fde-4dab-8b59-d05960dadd56" rel="nofollow">https:&#x2F;&#x2F;chatgpt.com&#x2F;share&#x2F;70af56e3-2fde-4dab-8b59-d05960dadd...</a><p>Just asking if there&#x27;s a problem and asking Chat GPT to rank the error leads the memory leak error to be categorized as low criticality though.<p><a href="https:&#x2F;&#x2F;chatgpt.com&#x2F;share&#x2F;68eb706a-05eb-44ca-8e2b-abc97c04227d" rel="nofollow">https:&#x2F;&#x2F;chatgpt.com&#x2F;share&#x2F;68eb706a-05eb-44ca-8e2b-abc97c0422...</a><p>Pretty promising though that it was able to point out the problem even without pointing it out and it definitely caught the memory leak issue.<p>Claude 3.5 Sonnet was able to figure it out right away without pointing it out though.
hfoiwufasdfw11 months ago
Most languages have a rule of thumb when it comes to freeing resources; it is your responsibility to abide by them.<p><pre><code> Rust: drop C++: T::~T() C#: using + dispose Java: try-with + autocloseable, or finally Go: defer Haskell: bracket JavaScript: finally Python: finally or with + __exit__ </code></pre> Don&#x27;t like it? Vote for linear types.
jeffrallen11 months ago
For a piece of code like this, it&#x27;s too bad there is not a relatively easy conversion possible to an arena-based allocator. Because then the leak would not be relevant.<p>I wonder if it would be possible in Rust to do some magic at the Rust&#x2F;C border in order to trick old C code into living inside an arena that is invisible to it?
akira250111 months ago
Tangentially.. this is one of the things I don&#x27;t like about a lot &quot;newer&quot; languages, like Rust and Zig. They seem to really love adding these single character sigils to the language that drastically change the meaning of a line of code or maybe an entire function.<p>As I get older my eyes strain more and all of this power packed into a single character really just puts me off. It seems like a strategy to emphasize writing code quickly rather than correctly, which is odd, given that this is opposite to the value proposition these languages purport to bring.
评论 #40771853 未加载
评论 #40770888 未加载
评论 #40771796 未加载
评论 #40785605 未加载
评论 #40772037 未加载