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.
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.
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
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.
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).
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?
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.
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.
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.
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
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){}
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.
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.
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.
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.
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.
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)
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...
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!"
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.
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.
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.
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
104
u/GuybrushThreepwo0d Sep 21 '26
We still do?
639
u/the-year-is-2038 Sep 21 '26
back in my day we used to manually mismanage memory
435
u/WisePotato42 Sep 21 '26
You could pass references as variables and change the referenced value IN THE FUNCTION!!!
children screaming sfx
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.
78
u/DOOManiac Sep 21 '26 edited Sep 21 '26
"We used to manually alloc all our memory"
"And free it too, right?"
"..."
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...
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/TeachEngineering Sep 21 '26
I like to whisper to myself
mallocwhenever 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
GoodFrustrating old days1
u/hmmm_42 Sep 21 '26
No memory, no problem, all hail the ai boom!
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/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