Mastering Memory: Allocation Techniques in C, C++, and ARM Assembly

  Рет қаралды 137,220

LaurieWired

LaurieWired

Күн бұрын

In this video, we explore equivalent memory allocation techniques in C++, C, and raw ARM assembly. We discuss the methods and system calls associated with each language to allocate then free memory once a dynamic variable is no longer required.
---
Timestamps:
00:00 Intro
01:46 C++ Memory Allocation
05:41 C Memory Allocation
09:50 ARMv7 Assembly Memory Allocation
16:18 Conclusion
---
LaurieWired Socials:
linktr.ee/lauriewired

Пікірлер: 576
@gmjammin4367
@gmjammin4367 2 ай бұрын
I very rarely watch tutorials but the arm segment made this video worth watching.
@MarkMusante
@MarkMusante 2 ай бұрын
you're in luck, lauriewired has a whole series on armv7: kzbin.info/aero/PLn_It163He32Ujm-l_czgEBhbJjOUgFhg&si=3d2NIEvWJLvbse_X
@blackice3403
@blackice3403 2 ай бұрын
​@@MarkMusanteTY
@BlackHermit
@BlackHermit 2 ай бұрын
Same here!
@StellarFireflyGaming-rm2xu
@StellarFireflyGaming-rm2xu 2 ай бұрын
Not only appreciating the low-level information in the tutorial, but also loving the SE: Lain production aesthetics!
@StellarFireflyGaming-rm2xu
@StellarFireflyGaming-rm2xu 2 ай бұрын
My only little complaint is referring to C's malloc() as a keyword instead of a standard library function. I know that at a beginner's level it may as well be treated like a keyword. But it wouldn't have taken much nor would it have been too confusing to beginners, to simply mention that it is a function and then explain why that "#include " is at the top.
@jessedevore
@jessedevore 2 ай бұрын
Current C++ core guidelines actually recommend against directly using new and delete in favor of smart pointers. std::make_unique and std::make_shared are the way to go. I also get that it's important to understand new and delete. Hats off to you for doing memory management in assembly!
@75yado
@75yado 2 ай бұрын
good luck with making equivalent calls in c and asm
@tripplefives1402
@tripplefives1402 2 ай бұрын
​@@75yado smart ptrs use new and delete under the covers.
@75yado
@75yado 2 ай бұрын
@@tripplefives1402 I know and a little bit extra to ensure smartness and security and doing that little bit extra in asm or C would prolong the video to several hours
@Denis-in6ur
@Denis-in6ur 2 ай бұрын
I hear that a lot. Please, don't let these guidelines take over thinking. Smart pointers have their advantages over the default pointers - but they always come with costs. They aren't a fit for every system and every program that gets written. Smart pointers have their flaws and its important to know the difference and when to use them. There is no "right pointer". That is a made up concept. Smart pointers are an abstraction layer and as always, the developer has to decide what fits best.
@tripplefives1402
@tripplefives1402 2 ай бұрын
@@75yado It's just a container with a pointer in it that has a reference counter that behaves like a garbage collector so you can't use after free. You could probably do that in 5 minutes. It's even implemented in vanilla C++ code so you could just look at the header files and see how it actually works. It's not some super hidden thing in the compiler or anything.
@PapaSMURFFS
@PapaSMURFFS 2 ай бұрын
Oh man, there are so many callouts to Serial Experiments: Lain in your staging/setting! Long time since I watched it, I love it!
@chutipascal
@chutipascal 2 ай бұрын
I like that you use the universal answer to everything for the content of the memory.
@NnO0Worries
@NnO0Worries 2 ай бұрын
you 're at 42 likes so I'm just gonna add a thumbs up remark 🙂
@JannisAdmek
@JannisAdmek 2 ай бұрын
I just discovered this channel, the visuals are super neat! The computers in the background, the Windows XP task bar and the window border around the web cam, wow!
@sudhanshugorwadkar3839
@sudhanshugorwadkar3839 2 ай бұрын
The amount of effort and dedication you put in editing these videos is commendable👏 Great tutorial as always!
@julianocardarelli5106
@julianocardarelli5106 2 ай бұрын
Perfect. Nowadays people do not have any idea about low level. Congratulations for bringing up your knowledge.
@InternetArbiter
@InternetArbiter 2 ай бұрын
the computer is not a substitution for living in real life. Don't forget that in all your typing.
@julianocardarelli5106
@julianocardarelli5106 2 ай бұрын
@@InternetArbiter , consider that when talking with hardware engeneer or someone who is responsible for a tool like a framework or a virtual machine used by millions of other softwares. Consider that for the set of systems that control the airplane you will travel. Consider that when the can network of your car is running using a microcontroller that has no space to use objet orientation...
@ScottHess
@ScottHess 2 ай бұрын
I still remember when it was reasonable to ask candidates to design a malloc library as an interview question. Sigh.
@InternetArbiter
@InternetArbiter 2 ай бұрын
Guess what, champ. We don't need software like the piles of money investors throw at your inflated salary suggests. Your profession is swiftly coming to a breaking point and you might not even know it if you aren't from the US. Consider that you are following someone else's footsteps, no matter how deep the rat race maze goes for you. Did you find the cheese yet?@@julianocardarelli5106
@julianocardarelli5106
@julianocardarelli5106 2 ай бұрын
@@ScottHess , I also remember that. Actually, nowadays it doesn't make any sense in a interview. I agree with that. But it still makes sense for engeneers only, not for 80% of web application developers and mobile developers. Hardware engeneers, developers/engeneers working with embedded software for example, they need to apply those concepts on the video.
@chari6471
@chari6471 2 ай бұрын
Never subscribed to a channel so fast! What a really cool style of video, with clear, helpful explanations. Good up the good work :D
@fios4528
@fios4528 2 ай бұрын
I really hope this channel takes off. You put a ton of effort into your content!
@blaketurner9389
@blaketurner9389 2 ай бұрын
Thank you Laurie. I love that you run through the C version, being that it is the foundation of most modern memory allocation. The ASM version is absolute candy. Assembler is a dying art. More than ever becoming the domain of a very limited few. A simple clean run through the basics of a controversial and complex topic. 🥳🤓🤠
@christopheroliver148
@christopheroliver148 2 ай бұрын
I think part of that is that the instruction set on most common machines is a quite hairy thing compared with say a Z80, PDP-11, or even 68000. I can usually grok the output from gcc -S or Lisp's #'disassemble. I don't write X86 code though save for doing thing like putting a debug trap into my C copde to break out to the debugger. That's not to say I'm averse to working in assembler for a sane architecture.
@christopheroliver148
@christopheroliver148 2 ай бұрын
I want to add that I think some exposure to assembly language is a must. I just wish there was a UNIX like machine with simpler architecture like to 68000 based Sun 3 for kids to learn on.
@imalebowski
@imalebowski 2 ай бұрын
Niche af but this is the best KZbin video on memory allocation techniques I've ever seen by a country mile. Seriously, this is an amazing video and you should be proud.
@superduper6090
@superduper6090 2 ай бұрын
Honestly, I have a couple issues. Mostly with the C section of the video. I can ellaborate if you want but im not gonna type it if youre not going to see it.
@superduper6090
@superduper6090 2 ай бұрын
Theres also some issues with the c++ section. To be frank the video lacks detail and explanation, and I honestly think there are much better videos out there.
@imalebowski
@imalebowski 2 ай бұрын
@@superduper6090no I'll see it. It's not like I've seen many KZbin videos on memory allocation techniques. But tbh maybe rather than writing a critique here a blog might be better, or another video that can take the mantle.
@superduper6090
@superduper6090 2 ай бұрын
@@imalebowski issues: - Using delete and new in c++ is bad practice. make_unique and make_shared is how it should be done. - Calling malloc and free keywords. Malloc and free are in no way keywords and referring to them as such can really screw over a person whose learning. - This isnt really something they got wrong, but they didnt really explain whats happening when they create a pointer to memory in C. Also, they did allocate memory in C but they didnt really do it in a placr that makes sense since your ints automatically get allocated memory as soon as theyre created. Something better would have been an array of ints. These are just the ones off the top of my head. The video was ok but I think it could have been better, regardless teaching these things is no easy feat and they should be proud they tried regardless.
@rmfeld
@rmfeld 2 ай бұрын
What a wonderful gem of a video! Love the technical deep dive and the graphic design!
@BrunoSXS
@BrunoSXS 2 ай бұрын
The effor to create the vfx for those videos are something to marvel on its own... What impresses me is that the content is even greater. I know my way around 6502 asm and seeing this made me want to do arm asm just because...
@martijn3151
@martijn3151 2 ай бұрын
Just as a best practice tip: always set your pointers to null after dealloc/free.
@iro4201
@iro4201 2 ай бұрын
Which null?
@sheesh7872
@sheesh7872 2 ай бұрын
@@iro4201null like 0 /s
@marksmod
@marksmod 2 ай бұрын
and don't forget: the more stars you use, the better.
@sheesh7872
@sheesh7872 2 ай бұрын
​@@marksmodwheres my very valuable definitly seriös programming comment😢
@blaketurner9389
@blaketurner9389 2 ай бұрын
Nothing like using deallocated memory for a little random fun and games 🤣 most days I think this is a lesson best learnt the hard way, one is less likely to forget, EVER again 🤣
@KaustavMajumder
@KaustavMajumder 2 ай бұрын
Python enters the chat. "Memory what?" Python leaves the chat. 😁 Love your videos. Keep up the awesome and inspiring work. I'm digging deep into C++. It's pretty interesting.
@blaketurner9389
@blaketurner9389 2 ай бұрын
As Java laughed: "That's garbage"
@legion_prex3650
@legion_prex3650 2 ай бұрын
Basic knowledge of memory management should have even a mediocre python developer. but i have seen things.... omg. My assembly times are like 40 years ago but im am still coding in C sometimes. It's fun! But do a lot of python as well nowadays, it's just super convenient and easy. Anyway, you have to know what's going on under the hood. C++ is fun as well, have a nice time!
@yarpen26
@yarpen26 Ай бұрын
Doing only casual programming at best (and you could barely even call it that much most of the time), I'm somehow drawn to the concept of memory allocation. It just feels wrong for something this crucial to be taken care of by an interpretative layer instead of myself. To be fair, I only semi-understand the pointer stuff based on theory alone, that's why I want to try the real thing. That's the only way to learn, as practice proves.
@whannabi
@whannabi 26 күн бұрын
​@@legion_prex3650 I love coding in C but if we're being honest, I'm not doing anything substantial with it unless there's a big abstraction layer like Raylib which actually makes programming in C enjoyable and actually feels like you're moving fast.
@thewelder3538
@thewelder3538 9 күн бұрын
What you actually meant was... Python enters the chat. "Memory what?" Three days later, Python leaves the chat after everyone has died of old age. 😁
@0xReip
@0xReip 2 ай бұрын
This channel was one of my best discoveries
@emjizone
@emjizone 2 ай бұрын
@LaurieWired Thank you for this instrutive demo. I feel at home in the atmosphere you create in these videos, even though my house has never looked like this.
@stacksmasherninja7266
@stacksmasherninja7266 2 ай бұрын
Great video! Especially the assembly section. In my (albeit limited) experience, it often helps to allocate memory in terms of pages rather than individual bytes. The page size is definitely not a consistent or constant standard value that you can simply hardcode in your programs. Effects of page size (fragmentation or page faults) are super apparent when deploying anything large-ish scale (say PostgreSQL db) on your ARM device. If you insist on doing everything in assembly, make sure your program adjusts for this variability in page size when compiling and makes it so that certain variables are "aligned" well for faster access. Your C compiler will most likely already handle all of this better than you without you even realizing it which is why in my opinion, programming in C is a "safer" bet for performance, readability and your own sanity.
@colinrk
@colinrk 9 күн бұрын
This is my new favorite yt channel. No other coding-tutorial-tubers even come close enough to touch this.
@bdfb-th5ek
@bdfb-th5ek 2 ай бұрын
Great series! I wanted to learn ARM assembly in my spare time and your videos are bite-sized and friendly to newbies
@CallousCoder
@CallousCoder 2 ай бұрын
I also have a set of 6 videos on ARM64 ending with actually doing GPIO on the Pi4.
@mitigamespro8757
@mitigamespro8757 8 күн бұрын
@@CallousCoder Cool, I might check it out soon!
@LadyTink
@LadyTink 2 ай бұрын
Love the lain vibes Absoluetly a treasure of a show. Also, love the walk through thank you for making this walk through
@mytechnotalent
@mytechnotalent Ай бұрын
Incredible tutorial Laurie. This is so important for anyone working with dynamic memory. This is something I would recommend coding along on the Pi.
@Beastintheomlet
@Beastintheomlet 2 ай бұрын
This my first video of yours I’ve found (thank you algorithm!) and I absolutely love your style. You’re an excellent presenter and the thematic aspects of an old Apple style GUI is charming without being repetitive. Instant subscribe! One small piece of feedback, the dark blue text on a black background was really hard for me to read with my color blindness, just a small thing but wanted to mention it.
@user-lv6pb9nv5y
@user-lv6pb9nv5y 2 ай бұрын
Wonderful video. I love the comparisons between C & C++ and ASM. These are my types of video, contrast and comparison!
@OeHomestead
@OeHomestead 2 ай бұрын
What a brilliant video, and it sure brings back memories *no pun intended* :-) I started with 68k ASM back in the 80's on the Amiga and continued learning C/C++.
@quackcharge
@quackcharge 2 ай бұрын
started learning C recently, very helpful. appreciate it :)
@lost4468yt
@lost4468yt 2 ай бұрын
This channel is really impressive. You seem to have everything down somehow - you know a ton about the subject matter, your presenting is brilliant and you can distil your knowledge down, the video style and presentation is fantastic, and so is the cinematography. Really everything is brilliant, and it's clear you're still improving (e.g. I looked through the channel and your thumbnails have gotten way better over the past several months - I love this one and the recursion one). Can't believe I haven't seen your videos sooner. Looks like the algorithm has latched onto them though as I'm getting suggested a bunch recently.
@TetrisMaster512
@TetrisMaster512 9 күн бұрын
Heads up for anyone working in C, you don't need to worry about casting the return value of malloc. Unlike in C++, void* will implicitly cast to other pointer types without throwing an invalid conversion error. This just maintains symmetry with casting *to* void* which is implicit in both C and C++. It's ultimately a stylistic decision whether to keep the explicit casts even though they're redundant, but my understanding of what idiomatic C looks like involves just letting the language cast void* for you in basically every situation.
@slmille4
@slmille4 2 ай бұрын
Memory allocation is easy, it's deallocation that's the problem 😅
@--Nath--
@--Nath-- 2 ай бұрын
Meh, deallocation is easy too. Your application still working successfully when you deallocated something you still needed is the tough one. ;)
@yOkay_
@yOkay_ 2 ай бұрын
free?
@slmille4
@slmille4 2 ай бұрын
@@yOkay_ oops, something was still using it, now you have a "use-after-free" error
@yOkay_
@yOkay_ 2 ай бұрын
@@slmille4 I never forget a free
@slmille4
@slmille4 Ай бұрын
@@alexsouza4701 that's only half the problem
@digicyc
@digicyc 24 күн бұрын
ohhh the Lain like intro has made me your biggest fan. Really enjoyed this tutorial and your knowledge. Hope to see more, especially around ARM based ASM. ^_^
@s1gma9000
@s1gma9000 Ай бұрын
the production value is sick, cudos to that for the effort.
@yubtubtime
@yubtubtime Ай бұрын
I already knew how to manage dynamic memory in C, so I had a leg up, but those were all better examples than I can remember seeing anywhere else outside of Kernighan and Ritchie! I tried to learn C++ when I was 12, but the syntax seemed needlessly exotic, so I've avoided it since. Your example was clear enough that I finally see the utility though, for example, in its string formatting. I've also kinda' sorta' wanted to learn assembly for 25+ years, but put it off because it also seemed so tedious, but that was such a well motivated example that I have a real itch to try my hand with it in earnest now! Awesome channel-keep up the great work 🙌
@haroldcruz8550
@haroldcruz8550 Ай бұрын
My only problem with the video is that she type casted a malloc return.
@betatrix8474
@betatrix8474 21 минут бұрын
amazing video from wired, thanks!
@WillianSilvaNet
@WillianSilvaNet 2 ай бұрын
I also have to agree with most of you folks. This video edition is amazing! And thanks for the ARM part. I never saw an ASM code for ARM before. It's quite different!
@snesmocha
@snesmocha 2 ай бұрын
I didn’t expect this to be a good tutorial. You proved me wrong. Damn this is actually really good
@xiangshunbei6569
@xiangshunbei6569 2 ай бұрын
Just want to mention that the new in c++ is an override op, which means there’s a second usage for it, replacement new. You can place your data to a specific pre-allocated memory address. It’s a good way to do something like memory pool to avoid fragment/performance issues happen on traditional c++ new. (But be sure to do profiling because modern compile/OS may help you on this kind of things)
@surters
@surters 2 ай бұрын
Also for this usage we should use unique_ptr and make_unique (or shared_ptr). The allocators make a lot of work easier in pooling resources.
@shanks919
@shanks919 2 ай бұрын
Thank you for the course. It was very helpful!
@georginikoloff9280
@georginikoloff9280 2 ай бұрын
this video is really great. very neatly explained and the speaker is fantastic
@Kaspean-sea-monster
@Kaspean-sea-monster 2 ай бұрын
Let's all love Lain!
@nirmalperera3665
@nirmalperera3665 2 ай бұрын
Thank you! Crystal clear explanation :) Learned a lot!
@rafaels.5503
@rafaels.5503 Күн бұрын
You were able to make a c/c++/ASM vídeo look modern and appealing. I love the "résistance hacker" aesthethic of it, that is the feel low level gives me. As for the content itself I'm still a student so I cannot opine on it, I'm just watching and trying to learn from it.
@ajdarseidzade688
@ajdarseidzade688 2 ай бұрын
A very useful lesson (in different languages!) and very beautifully told!
@13p14_
@13p14_ 2 ай бұрын
My God, I love this channel
@limsiryuean5040
@limsiryuean5040 2 ай бұрын
Great video on low level programming, especially when explaining programming and memory allocation in parallel. Its even better than codeacademy and other tuturials that I've seen
@Slycooper2456
@Slycooper2456 2 ай бұрын
Great vid it is really enjoyable to watch and learn!
@david-6110
@david-6110 2 ай бұрын
Excellent video (and it also reminds me the number of memory allocation mess I did as an enthusiastic Z-80 assembly coder back in the days :D)
@mambomambo4363
@mambomambo4363 2 ай бұрын
Thanks for the video. I learnt a lot about the French revolutuon.
@DotDager
@DotDager 2 ай бұрын
Excellent as usual!
@gcm4312
@gcm4312 2 ай бұрын
just found your channel. very high quality content! I think I saw your presentation at Defcon last year (one of the few I managed to attend :D)
@597das
@597das 2 ай бұрын
love watching videos on assembly. I'd love to learn more (mainly so I can confidently step through shared libraries while debugging) but I don't really know what a fun assembly project would look like...
@shizoor
@shizoor 26 күн бұрын
Excellent! Thanks for this!
@JhonAlberPerezPerez
@JhonAlberPerezPerez 2 ай бұрын
In the university I thought assembly was hard but with time, I began using... like it and is very easy... with it I learned to read all type code c,c++,html.
@MrHaggyy
@MrHaggyy 2 ай бұрын
It's quite interesting to look in the assembly generated by the C++ and C programs as well. If you want to go low level with C++ you can use placemet new. It's used to allocate a usefull chunk of memory, like the page you allocated in the ASM version. At a later point you can decide which datatypes you actually want and you can do fast addr+sizeof(dt) shananigans.
@adelarsq
@adelarsq 2 ай бұрын
Cool! That video is a gem! Thanks for video!
@bigbooduh
@bigbooduh Ай бұрын
I love your channel, been wanting to learn arm assembly
@SergeantPepper
@SergeantPepper 2 ай бұрын
Thanks for showing the ARM assembly memory allocation example. KZbin is lacking in good ARM assembly memory resources. I fumbled my way through doing ARM memory allocation using the brk syscall. Now I know where to go if I want to use mmap
@CN-Aqi
@CN-Aqi Ай бұрын
Hi friends, I hope to get in touch with you and become friends. I need some technical support, let's create wealth together.
@Red_Paper6495
@Red_Paper6495 28 күн бұрын
C++ -> C ->ARM Assembly -> Transistor -> switching of pn junction -> atom manipulation -> electron manipulation -> quark control.
@QuantenMagier
@QuantenMagier 16 күн бұрын
You forgot VHDL FPGA programming / Circuit Design between Assembly and Transistor level!
@Red_Paper6495
@Red_Paper6495 16 күн бұрын
@@QuantenMagier Damn Exactly))
@wiebel7569
@wiebel7569 2 ай бұрын
Wow, this was the most compact in depth video I have every seen, amazing. Thank you. What I don't get is why are you reassigning #-1 to r0 in alloc_failed, isn't it already #-1 in the first place?
@ExtremeTeddy
@ExtremeTeddy 2 ай бұрын
Interesting to see that ASM malloc code including the explanations :) And this 90's transmission style is pleasant to watch. Dang I feel old when thinking about it 😅 Last time I've seen OS windows look similar was when Win 3.1 - Win98 have been around ...
@oszb
@oszb 2 ай бұрын
very dank editing.
@TheSpeedturns
@TheSpeedturns 2 ай бұрын
the lain editing i love it!
@markmanning2921
@markmanning2921 2 ай бұрын
It is a better practice to say foo *f = malloc(sizeof *f)) for what ever type foo is i think it would also be good if you explained on thre ASM version why you were invoking the C compiler, not everyone will understand the requirement to link your object files after compilation or why you would not just do that using ld itself.
@hacklab6757
@hacklab6757 21 күн бұрын
Incredible thanks to keep it real !
@that_smitty_dude
@that_smitty_dude 2 ай бұрын
Hi, novice here. Thank you for posting this. I was wanting to learn more about safe memory usage but since I'm trying to teach myself this stuff, I had no clue how it actually works.
@pedrobotsaris2036
@pedrobotsaris2036 2 ай бұрын
You can call mmap in both c and c++. You don’t need to write assembly for that.
@christopheroliver148
@christopheroliver148 2 ай бұрын
Yup. Good for fun tricks like circular buffers where base-index addressing works even off the far end of the buffer. (I.e. map it again at the consecutive address)
@v3dsoft
@v3dsoft 10 күн бұрын
There is one important aspect of manual memory allocation in high-level languages, that is rarely mentioned in tutorials. Make sure you deallocate memory using the exactly same mechanism, that was used for its allocation. I worked on a piece of C++ code once, and it was running fine on both Windows and Linux. But when I tried to compile and run it on more exotic platform (DOS cross compile with DJGPP if anyone interested 😎 ), the program crashed because of corrupted memory. It happened because I allocated a chunk of memory using aligned version of operator new, but released it with the default delete. Apparently on Windows/Linux both versions have compatible implementations, so everything worked perfectly. Unfortunately on a platform where they are not compatible everything crashed with a really unexpected and cryptic error message, so be careful.
@c.n.crowther438
@c.n.crowther438 Ай бұрын
This is solid af. subbed. thanks.
@DmitriNesterov
@DmitriNesterov 2 ай бұрын
Несмотря на то, что я знаю и английский и C, и C++, и немного Ассемблер, я ничего не понял, но получил массу эстетического удовольствия 😂❤ Присоединяюсь комментатором, которые пишут perfect.
@HyperFocusMarshmallow
@HyperFocusMarshmallow 2 ай бұрын
I’ve been trying to pick up a bit of assembly recently. x86 rather than arm, but the philosophy is still useful. Compliment on the production and presentation btw. The videos look great! My first computer was a 90s Mac so it feels right at home and you use it to draw the eye to relevant information.
@CN-Aqi
@CN-Aqi Ай бұрын
Hi friends, I hope to get in touch with you and become friends. I need some technical support, let's create wealth together.
@raflend6543
@raflend6543 2 ай бұрын
Your opening of lain ❤, I love it
@freziyt223
@freziyt223 Ай бұрын
Wow, the preswntation actually looks cool!
@mx7233
@mx7233 2 ай бұрын
It's amazing how you break these things down and novel to do this at a speed where a beginner might actually understand it. 🥳 What would have been nice is to include the full code somewhere (talking about the assembler part here). As the video appears kind of inviting to code along, for example the code after the exit label is never shown. I had to put this together from other videos. Alternatively it would have been nice to have a pointer to the code/the video for the stub you started with.
@nomad-1776
@nomad-1776 2 ай бұрын
Thanks for the videos. I'm only on my second semester of computer science and find a lot of this to be confusing, though I'm learning a little bit I think. Some day I'll be able to read and write assembly proficiently too.
@rpeckhoff
@rpeckhoff 2 ай бұрын
Topic I'm passionate about... very competent presenter...who happens to be attractive... clean editing with dope 90's references that remind me of Beakman's world. Maybe there's no drama? I'm trying to put my finger on why I'm bored. Maybe its more entertaining if things are broke? I still love the content from Laurie Wired.
@lauriewired
@lauriewired 2 ай бұрын
would it help if I threw the computer at the wall to free the memory?
@rpeckhoff
@rpeckhoff 2 ай бұрын
@@lauriewired rofl! Got to keep all the badgers and snakes inside those classic machines of yours. Maybe a few syntax errors or memory errors?… what llvm vs gcc says… or static checker when you screw up? Dunno. Keep on. Still very much looking forward to your next video. They’re very well made.
@CN-Aqi
@CN-Aqi Ай бұрын
Hi friends, I hope to get in touch with you and become friends. I need some technical support, let's create wealth together.
@michaelbauers8800
@michaelbauers8800 2 ай бұрын
I get the point of this video, I just wanted to add something. II you are doing serious C++ development, you probably want to use std::shared_ptr, and similar smart pointer allocators. When the last reference goes out of scope, the memory will be released. I am sure there's situations where this will cause problems, but for typical use cases, this might simplify the program.
@dazealex
@dazealex 2 ай бұрын
Aww man, I am so behind on the new things in C++, last time I worked with it was in 1998... Things have changed for the better. Thanks for the tip.
@IamusTheFox
@IamusTheFox 2 ай бұрын
​@@dazealexoh man, you'll love it! So many things that will make your life better. Jason Turner has made a few videos on the most important features of c++11,14,17,20, and 23 if you want a quick reference I'd start there
@dazealex
@dazealex 2 ай бұрын
@@IamusTheFox Oh thanks man! Will check those out. Sounds like fun, and back to C++!
@QuantenMagier
@QuantenMagier 16 күн бұрын
This is one of the reasons why C++ is worse than C; people don't know how to write proper code anymore and just trust weird garbage collections to manage their memory. I mean I can sometimes see use in reference counting like std::shared_ptr, but "when the last reference goes out of scope" makes me worry; please use proper delete statements even for your shared pointers and dont abuse them as garbage collectors to "simplify typical use cases", having a shared pointer means multiple references to the same object from different scopes and is not a typical use case, using them for single reference garbage collection is just abuse.
@IamusTheFox
@IamusTheFox 15 күн бұрын
@@QuantenMagier Respectfully, I don't think you fully understand smart pointers. shared_ptr is not GC, and is an atomically counted variable that frees the memory when the counter is 0. I agree that you shouldn't reach for shared_ptr as your go-to tool. unique_ptr basically just calls the deleter when the object goes out of scope. No counting, nothing.
@nathanmarotz8945
@nathanmarotz8945 2 ай бұрын
lain mentioned! busy learning julia and data science rn but bookmarking this for later.
@DigitalDesignET
@DigitalDesignET Ай бұрын
I love it, good tutorial. To visualize what is going on, it would be good to do it in debugging mode and look at what is happening in the memory.
@nglpos
@nglpos 2 ай бұрын
Your videos are great. Thanks for producing them. One pointer...you say "go ahead and..." a lot. If you omit that phrase from your delivery, you'll sound even more professional.
@CN-Aqi
@CN-Aqi Ай бұрын
Hi friends, I hope to get in touch with you and become friends. I need some technical support, let's create wealth together.
@DART2WADER
@DART2WADER 12 күн бұрын
2:20 Use everything from the header instead of the 'new' and 'delete' .
@keopsequinox1624
@keopsequinox1624 2 ай бұрын
Just discovered your channel. Excellent video.
@redcrafterlppa303
@redcrafterlppa303 2 ай бұрын
2:20 don't use new and delete in c++ use unique_ptr or shared_ptr if necessary.
@Calypso694
@Calypso694 2 ай бұрын
no idea who you are but the algorithm has blessed you. Subbed. Cool seeing code girls more often get recognized.
@InternetArbiter
@InternetArbiter 2 ай бұрын
yeah you love seeing psyops and marketing don't you?
@Calypso694
@Calypso694 2 ай бұрын
@@InternetArbiter what?
@ingframin
@ingframin 2 ай бұрын
You do not need to typecast malloc in C. You do need it if you use malloc in a c++ program. The C compiler does automatic casting between the void* returned by malloc and your int*.
@lauriewired
@lauriewired 2 ай бұрын
That's true. However, typecasting is best practice. It makes the code clearer to read, and is taught that way in many universities. Also in the off chance you end up using a C++ compiler with C code, typecasting will reduce compilation errors. I understand how it can be a controversial topic, but it's mostly a stylistic choice.
@richogem
@richogem 2 ай бұрын
there isn't a singular C compiler. always typecast malloc in C or expect the unexpected.
@antred11
@antred11 2 ай бұрын
@em If it's a standard compliant C compiler, you will be fine without the explicit cast.
@richogem
@richogem 2 ай бұрын
@@antred11 why would you ever want to take that chance and risk undefined behaviour? Just use python if u dont wanna bother typecasting?... Always typecast malloc.
@antred11
@antred11 2 ай бұрын
@@richogem Because the C standard itself says you don't need the cast?
@sumas7
@sumas7 2 ай бұрын
I see there are *a few* lain references in this whole channel, and I'm all for it
@GoWithAndy-cp8tz
@GoWithAndy-cp8tz 2 ай бұрын
Hi. Malloc returns memory address so it would be enough for better readability: numPtr=malloc(sizeof(int)); if you first declared int * numPtr; alternatively if you want to declare a pointer and assign memory address to it at one step your version is perfect. Cheers!
@91thewatcher23
@91thewatcher23 17 күн бұрын
I thought try catch was generally frowned upon. Thanks for the great info. Sick background btw
@cervelliera
@cervelliera Ай бұрын
I do not know anything about code, but great vid (Seriously, great narrator)
@davidwang7489
@davidwang7489 2 ай бұрын
Awesome! Now use assembly to write ARM page table entries to map in memory. 😊 That can be pretty useful in kernel mode shellcode.
@adonaidiogenes8536
@adonaidiogenes8536 2 күн бұрын
C++: Understandable. C: Ok. Thats fine. ARM V7 ASSEMBLY: "My God, my God, why have you forsaken me?"
@onaecO
@onaecO 2 ай бұрын
My fav channel! ❤
@RushOrbit
@RushOrbit 2 ай бұрын
Props for good lighting technique.
@sqaxomonophonen5998
@sqaxomonophonen5998 2 ай бұрын
I'm glad I'm not the only one who writes `int* num_ptr` instead of `int *num_ptr` :-)
@di380
@di380 2 ай бұрын
For people who don’t appreciate the level of abstraction of a high level language. All the code that is needed in assembly just to allocate an integer in memory dynamically you have to deal with system calls and memory pages since you can not just request 4 consecutive bytes 😢
@QW3RTYUU
@QW3RTYUU 2 ай бұрын
I hope this channel encourages more people to coding! I think if it gives a nice example to lookup to for girls to get into the field. You go and enjoy the coding people!
@sarundayo
@sarundayo 2 ай бұрын
Wish teachers in school were half as good as you are 🙌
@ivelinkarageorgiev3111
@ivelinkarageorgiev3111 2 ай бұрын
That's the cutest channel ever, loved it ^^
@cainabel2553
@cainabel2553 2 ай бұрын
I'm falling in love with your Mac aesthetics. OTOH I hate that aliasing flickering behind you!
@mohammed.essaber
@mohammed.essaber 12 күн бұрын
oh such nostalgia I love you I love c++
@xaza8uhitra4
@xaza8uhitra4 2 ай бұрын
awesome video Laurie, im learning so much from your work. Uhh can someone help me understand though, with the arm assembly example - was this emulated in the raspberry pi or on other hardware ? and in what OS is she editing the code and running the arm example?
Deciphering Obfuscated JavaScript Malware
31:12
LaurieWired
Рет қаралды 60 М.
I made the same game in Assembly, C and C++
4:20
Nathan Baggs
Рет қаралды 637 М.
Когда на улице Маябрь 😈 #марьяна #шортс
00:17
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 88 МЛН
How I prepare to meet the brothers Mbappé.. 🙈 @KylianMbappe
00:17
Celine Dept
Рет қаралды 45 МЛН
Making Simple Windows Driver in C
7:26
Nir Lichtman
Рет қаралды 294 М.
Linux in a Nutshell
3:58
DoughnutToast
Рет қаралды 22 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 73 М.
What ACTUALLY happens during a Stack Overflow?
12:43
LaurieWired
Рет қаралды 119 М.
why is it illegal to use "goto"?
5:23
Low Level Learning
Рет қаралды 239 М.
WHY IS THE HEAP SO SLOW?
17:53
Core Dumped
Рет қаралды 186 М.
i wrote my own memory allocator in C to prove a point
5:23
Low Level Learning
Рет қаралды 340 М.
A Competition for Unreadable Code?
12:33
LaurieWired
Рет қаралды 130 М.
how NASA writes space-proof code
6:03
Low Level Learning
Рет қаралды 2 МЛН
Индуктивность и дроссель.
1:00
Hi Dev! – Электроника
Рет қаралды 1,5 МЛН
A Comprehensive Guide to Using Zoyya Tools for Photo Editing
0:50
Apple, как вас уделал Тюменский бренд CaseGuru? Конец удивил #caseguru #кейсгуру #наушники
0:54
CaseGuru / Наушники / Пылесосы / Смарт-часы /
Рет қаралды 4,3 МЛН