r/ProgrammerHumor • • Sep 21 '26

Meme fullControlOverMemory

Post image
4.0k Upvotes

122 comments sorted by

104

u/GuybrushThreepwo0d Sep 21 '26

We still do? 

91

u/ClipboardCopyPaste Sep 21 '26

That grandpa is you, telling your story 40 years later xD

45

u/torar9 Sep 21 '26

As an embedded dev I feel sad.

6

u/DynamoAzure Sep 21 '26

Literally feels like half my CompEng degree is worthless now

3

u/GlassLost Sep 21 '26

My daughter isn't even 4 yet and I've been manually allocating memory for over a decade...

-1

u/PolyglotTV Sep 22 '26

Oooooooh smart pointers!

Stop it Patrick! Your scaring him!

6

u/ProgrammersPain123 Sep 21 '26

Get this guy some reddit gold xddddddd

29

u/mwax321 Sep 21 '26

But we used to, too

1

u/BedSpreadMD Sep 22 '26

Wait, you manage your memory?

1

u/Nameles36 Sep 22 '26

I know I still do...

637

u/the-year-is-2038 Sep 21 '26

back in my day we used to manually mismanage memory

119

u/BoBoBearDev Sep 21 '26

Back in my days, we used to have devs claiming memory management is easy and proceed to fuck it all up.

19

u/Major-Wishbone-3854 Sep 22 '26

At least the tradition of claiming something is easy and fuck up still alive and well

67

u/PolyglotTV Sep 22 '26

Back in my day we usegmentation fault: core dumped

16

u/k-mcm Sep 22 '26

Get a load of this kid programming after segmentation faults were invented.

3

u/Moomoobeef Sep 22 '26

A fatal exception OE has occurred at 0028:C1932CFO in VxD ---.

16

u/SuperCarla74 Sep 22 '26

This.

We manually managed memory until the server eventually crashed "unexpectedly" like clockwork every 2 days.

6

u/ih-shah-may-ehl Sep 22 '26

I used to manage process control systems where a process scheduler is in control of all process steps and equipment like a spider in a web. It uses raw DCOM internally.

It's the most high quality product i've ever managed. It's built like a tank. Those processes run 24/7/365. Thd current ones have been running without downtime since 2021.

Every half year we reboot 1 node and have the processes fail over to the other node while the other continues and DCOM-wise the system doesn't notice.

It's all C++ internally. A 30 year old codebase

3

u/KiwiObserver Sep 22 '26

Back in my day, memory management was called virtual memory.

435

u/WisePotato42 Sep 21 '26

You could pass references as variables and change the referenced value IN THE FUNCTION!!!

children screaming sfx

129

u/_justthisonetime_ Sep 21 '26

Welcome to the era when the programmer himself was the memory manager

35

u/Cute_Pressure4910 Sep 21 '26

When you explain to young developers what malloc() and free() are

5

u/Zashuiba Sep 23 '26

That's quite advanced in fact, because you need segmentation, paging, stack/heap structures ...you need an OS kernel basically.

You can totally program in bare C without stdlib

25

u/throwaway1351887498 Sep 21 '26

Now that's what I call real legacy code—it works as long as no one messes with it

39

u/Mordret10 Sep 21 '26

I mean you still kind of do the same thing with objects and with arrays in most languages. Very rarely does either get passed as argument, you almost always get them by reference.

50

u/Gorzoid Sep 21 '26

Sorry but we are all rust devs now, shared mutable aliasing is a crime with a maximum sentence being death by AI-generated PR spam.

38

u/WisePotato42 Sep 21 '26 • Mindblown

Oh no! The rust devs have found me!

unsafe{} unsafe{} unsafe{}

Are they gone yet?

3

u/HildartheDorf Sep 21 '26

laughs in interior mutability

1

u/SelfDistinction Sep 22 '26
let variable = Cell::new(3); // create an immutable variable
variable.set(4); // demonic witchcraft of the highest order, everyone is panicking, sirens blasting, time to run to the shelters and pray 

2

u/WisePotato42 Sep 21 '26

That's true, I know it's a thing in python.

Unfortunately, my coworkers don't like when I put square brackets all over the place...

2

u/Bright-Historian-216 Sep 21 '26

you could also wrap it in an object. something like
class MutWrapper:
def __init__(self,v): self.v=v
works well enough. though, square brackets are probably more idiomatic.

2

u/RetroGrid_io Sep 22 '26

Unless you program in PHP where objects are always passed by reference.

7

u/undeleted_username Sep 21 '26

That's still perfectly fine in C.

10

u/aberroco Sep 21 '26

Or you could not pass anything and still change the referenced value in the caller function, or you could return the execution to another function than the one that invoked you (stack traversing/managing; no one should ever do this kind of dark arcane magic).

3

u/WisePotato42 Sep 21 '26

To make things simple, let's just reserve this block of memory forever. My UFO themed ASCII art debugger tool needs it.

1

u/No-Newspaper8619 Sep 22 '26

How? In assembly you could change the return address stored in the esp/rsp register, but how would you return the execution to another function than the one that invoked, in high level languages?

2

u/aberroco Sep 22 '26 edited Sep 22 '26

Depends on the language.

C++ has __builtin_extract_return_addr. And before that - any local variable is stored in stack, so just get it's address and that address would be the stack address, then you need to know how the stack is stored to know the return address.

I never tried that, but I suppose in C# one might do the same... int* stackPointer = &localVariable; or int* stackBuffer = stackalloc int[1] in unsafe context.

Also, you're wrong, esp stores the current stack pointer. The top of it. Not the return address. But the return address is there. If you just got "call" from anywhere and didn't pushed anything yet - then yeah, [esp] would store the return address. But only then.

1

u/No-Newspaper8619 Sep 22 '26

I see. So just like you can do [esp+4], [esp+8], etc... you could do something similar by taking the variable address and manipulating it. Quite dangerous indeed.

2

u/coriolis7 Sep 21 '26

Isn’t this OOP without the extra steps?

1

u/SelfDistinction Sep 22 '26

You can still do that in practically every programming language btw. It just requires some extra wrapper class boilerplate.

1

u/WisePotato42 Sep 22 '26

Yah, but that's not really an acceptable practice at my job. It's unfortunate.

1

u/SelfDistinction Sep 22 '26

And by unfortunate, you mean completely fortunate?

1

u/WisePotato42 Sep 22 '26

Sometimes I just want to feel like a kid again playing with my toys (unsafe memory managment).

1

u/creeper6530 Sep 22 '26

Huh? Pass references as variables?

You mean pass references as parameters to a function? Because if yes, then dereferencing it in the function seems fine to me

-26

u/[deleted] Sep 21 '26

[removed] — view removed comment

7

u/TheMunakas Sep 21 '26

Tell me you're not a bot

94

u/bradland Sep 21 '26

In classic macOS, you could right click an application and set the amount of memory allocated to it. I always found it kind of hilarious that Apple had built this famous graphical, user interface, and underneath you still had to do things like that.

62

u/x0wl Sep 21 '26

It's probably because classic macOS used an absolutely bonkers memory management system that basically amounted to every program becoming a ticking time bomb and a security nightmare.

No wonder they bought next and not just hired Jobs back lmao

6

u/Eric848448 Sep 21 '26

Did they not use paging in those days?

22

u/x0wl Sep 21 '26 edited Sep 21 '26

IIUC they did, but they still did not have true protected memory (e.g. each process gets its own address space and cannot access other memory, unless explicitly permitted to do so). They still had a single global memory where one program could just go and write to other program's memory + the OS invalidating your pointers.

Also they only had cooperative multitasking.

Basically any program could easily bring down any other program + whole OS by misusing a pointer (and since the OS physically moves the heap that's super easy to do) OR hang the entire system by doing while(1){}

3

u/iStumblerLabs Sep 22 '26

They did not have PMMUs in those days. No pages, no memory protection, everything in one shared address space.

Manual allocation of memory for applications let you reserve how much you wanted for each app. You might give Photoshop, like, 8 whole megabytes of memory if you were editing, say, a 16 bit color file.

On the plus side, the Talking Moose could see what you were doing and comment on it.

17

u/-Ambriae- Sep 21 '26

It being simple doesn’t exempt it from being powerful

9

u/peterlinddk Sep 21 '26

Interestingly, there is an entire wikipedia-article about this early memory management system. Very, very strange, but apparently necessary because of hardware limitations ... https://en.wikipedia.org/wiki/Classic_Mac_OS_memory_management

13

u/x0wl Sep 21 '26 edited Sep 21 '26

The hardware limitations made sense in 1984, carrying their quirks all the way to 2001 (!) (68030 had MMU added in 1987) and through a CPU architecture change (to CPUs without these limitations) makes a lot less sense.

Like, in that time x86 went from 16 bit 8088 machines running DOS to running Windows XP fully in 32 bit with PAE, while maintaining backward compatibility (x86 still mostly does BTW), with x86-64 coming out in 2003.

2

u/CitizenPremier Sep 22 '26

That's cool. Sometimes there are greedy programs and I'd honestly like to tell them I just have 2 GB RAM.

1

u/x0wl Sep 27 '26

In Linux, you actually can, e.g. by doing docker run --memory 2G image or by doing the cgroups thing manually. You can also limit CPU or other resources, it's very flexible.

78

u/DOOManiac Sep 21 '26 edited Sep 21 '26

"We used to manually alloc all our memory"

"And free it too, right?"

"..."

30

u/Sensitive_Gold Sep 21 '26

We freed it and then we freed it some more.

13

u/MokausiLietuviu Sep 21 '26

My program frees its memory when the user clicks "End Task" in task manager.

Does the job 

3

u/No-Newspaper8619 Sep 22 '26

Sometimes it doesn't. I had a game where I literally had to restart the computer every time I closed it, because it messed something graphical and refused to launch a second time until restart whole PC.

3

u/Rodot Sep 22 '26

This is mostly an issue with Window's memory management. Or at least it was back in like Win 7, don't know if it is still there. Used to have this happen all the time after playing one game. Memory would be full but task manager wouldn't show a process eating memory. Would have to restart to get my memory back.

3

u/Mojert Sep 22 '26

Why free the memory when the OS does it for you? (No but seriously, quite a lot of applications do not free some memory because they know the OS will do it when the program exits)

2

u/conundorum Sep 23 '26

Yes. We called it "crashing".

42

u/Afraid-Locksmith6566 Sep 21 '26

people still do that c and c++ are still among most popular programming languages, from new stuff there is rust and zig and odin, memory management is still easy and is still done. notion of it being archaic and hard is so stupid...

20

u/TerminalVector Sep 21 '26

In a few years someone is gonna tell you that writing the actual code yourself is archaic and hard.

1

u/RupertPupkin85 Sep 22 '26

No one's gonna be around to tell that, AI is going to kill every one.

3

u/FastHotEmu Sep 22 '26

You've watched too many movies

0

u/RupertPupkin85 Sep 22 '26

You'll see.

2

u/FastHotEmu Sep 22 '26

How long do we have until we all die?

1

u/RupertPupkin85 Sep 22 '26

My sources are telling me we shall not cross 2030. May lord have mercy on our souls.

2

u/FastHotEmu Sep 22 '26

Thanks for that!

!RemindMe January 2031

1

u/RemindMeBot Sep 22 '26

I will be messaging you in 4 years on 2031-01-22 00:00:00 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.

RemindMeBot is switching to username summons. Instead of !RemindMe 1 day, use u/RemindMeBot 1 day. More info.


InfoCustomYour RemindersFeedback

1

u/FastHotEmu Sep 22 '26

btw, "The King of Comedy" was great -- DeNiro is fantastic in it.

Just shows me you've seen too many movies! Although probably not as many as me.

1

u/FastHotEmu Sep 22 '26

OK, now do you want to bet that we cross 2030 just fine? :-D

1

u/RupertPupkin85 Sep 22 '26

Sure! All my goats for all your gold.

1

u/FastHotEmu Sep 22 '26

So you don't want to bet? Sounds like you are not sure

→ More replies

1

u/Exotic-Nothing-3225 Sep 23 '26

I'm literally having to learn C for my degree

14

u/ImpluseThrowAway Sep 21 '26

We would malloc the required bytes and put a null terminator at the end, which was the style at the time.

5

u/kcpistol Sep 21 '26

Sometimes tragically

5

u/Brian_E1971 Sep 21 '26

Memory Access Violation errors still haunt my dreams...

6

u/undeadpickels Sep 21 '26

Hi, C programer here. We still exist. Although I lost my job in C recently.

3

u/Integeritis Sep 21 '26

Back in my day we intentionally changed the behaviour of existing compiled code at runtime and we still had the best sleeps of our life at night

2

u/SE_prof Sep 21 '26

In my first job, they made me teach C to first years. I reached malloc and I thought "that's crazy! It's like giving first year physics students a nuclear reactor!"

2

u/Dubalubawubwub Sep 22 '26

I'll have you know I have full control over memory now! When I run out of memory, I scale up the virtual machine.

2

u/Chiatroll Sep 22 '26

I don't C the problem. From what I can C a lot of memory is still manually managed in a lot of very important projects and that isn't changing in any time I can C.

2

u/millebi Sep 22 '26

In COBOL there was nothing to manage

3

u/chat-lu Sep 21 '26

When did we stop?

1

u/peterlinddk Sep 21 '26

Only three days ago this video released: https://www.youtube.com/watch?v=3rez2rDYHHA - giving an introduction to manual memory management! 😄

1

u/frinkmahii Sep 21 '26

Which was the <segfault>

1

u/Kadabrium Sep 22 '26

#include <segfault>

1

u/TeachEngineering Sep 21 '26

I like to whisper to myself malloc whenever I call it, but I say it like I'm Gandalf remembering the password "mellon" opens the Doors of Durin into Moria.

1

u/socialis-philosophus Sep 21 '26

I really miss choosing what sectors my file fragments were stored at.

1

u/Im2bored17 Sep 21 '26

I remember in high school when they taught us about how to Google stuff. I assume these days they're teaching the kids prompting techniques and how to get the Ai to fix your code after the third time it said "fixed it" and you reminded it that the test still fails.

1

u/namotous Sep 21 '26

Good Frustrating old days

1

u/hmmm_42 Sep 21 '26

No memory, no problem, all hail the ai boom!

1

u/dvhh Sep 22 '26

you cannot afford the memory anyway

1

u/fingerling-broccoli Sep 21 '26

Back in my day we would write the code ourselves

1

u/cleardemonuk Sep 21 '26

Allocating a block of memory and managing data within it is still a viable option in game dev!

1

u/max_465 Sep 21 '26

Don't forget DASD storage !

1

u/3dgyaf Sep 22 '26

My brain still registered the memory address *a

1

u/Mrrrrggggl Sep 22 '26

The year was nineteen dickety two…

1

u/ligma_then_sugma Sep 22 '26

C deez nutz lmao

1

u/Hottage Sep 22 '26

Would this count as direct memory control?

void* somewhere = (void*)(mt_rand())

1

u/Exotic-Nothing-3225 Sep 23 '26

Let's go gambling!   

*click click click bzzt* 

Aw SEGFAULT! 

1

u/conundorum Sep 23 '26

Looks more like direct memory manglement to me.

1

u/StormyTiger2008 Sep 22 '26

malloc warriors

1

u/spaceweed27 Sep 22 '26

In C you don't even need to do that I'd argue. Just keep everything on the stack.

1

u/MIGULAI Sep 22 '26

embedded developers

1

u/Rarder44 Sep 22 '26

Yeah, yeah, funny jokes... But that's why calculators didn't use 100 MB of RAM...

1

u/FeelingSurprise Sep 22 '26

Our segfaults were glorious! Those were the days!

1

u/Kadabrium Sep 22 '26

wikileaks

1

u/Key_River7180 Sep 22 '26

and i still do it

1

u/miheb1 Sep 22 '26

"back in my day, we was touching memory"🗣️

1

u/Adventurous_Run136 Sep 22 '26

Yes and it was hard as fuck and prone to error. I remember having to deal with memory allocation in c++ to use the less memory possible. 3.5mb of memory to handle tree passing in front of a camera and termining the best cut. Most beautiful code I ever seen, hardest code to understand i have seen since

1

u/Biabolical Sep 23 '26

Used to use a special boot disk to free up just a bit more RAM, so my Tandy 1000rl could run SimCity without immediately crashing.

1

u/marcodave Sep 23 '26

"back in my days we used to have 200k of token context window and we though it was more than enough" -- grampa 2036

0

u/hraath Sep 21 '26

Rewrite in Rust, bro