Fushuan [he/him]

Huh?

  • 0 Posts
  • 25 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle








  • Shared poibters are used while multithreading, imagine that you have a process controller that starts and manages several threads which then run their own processes.

    Some workflows might demand that an object is instantiated from the controller and then shared with one or several processes, or one of the processes might create the object and then send it back via callback, which then might get sent to several other processes.

    If you do this with a race pointer, you might end in in a race condition of when to free that pointer and you will end up creating some sort of controller or wrapper around the pointer to manage which process is us8ng the object and when is time to free it. That’s a shared pointer, they made the wrapper for you. It manages an internal counter for every instance of the pointer and when that instance goes out of scope the counter goes down, when it reaches zero it gets deleted.

    A unique pointer is for when, for whatever reason, you want processes to have exclusive access to the object. You might be interested in having the security that only a single process is interacting with the object because it doesn’t process well being manipulated from several processes at once. With a raw pointer you would need to code a wrapper that ensures ownership of the pointer and ways to transfer it so that you know which process has access to it at every moment.

    In the example project I mentioned we used both shared and unique pointers, and that was in the first year of the job where I worked with c++. How was your job for you not to see the point of smart pointers after 7 years? All single threaded programs? Maybe you use some framework that makes the abstractions for you like Qt?

    I hope these examples and explanations helped you see valid use cases.






  • Hate to type this but mate, skill issue. If its taking that much memory check your addons because you fucked up somewhere. I use it with several debugging and linting addons and it runs on a virtual remote desktop where I’m lucky if I have 4GB to share between vscode and the browser with 20 tabs open.

    Maybe your issue is thst you ran heavy programs through the vscode console and those registered in the task manager as vscode? Idk, but either way, skill issue :P


  • Oh, here’s the 4 pages of documentation of items and crafting recipes of this nodded game I’m playing that are open at all times.

    Then there’s the tsb with the video series I’m watching, the tab with the dropout home, other two tabs for two series I’d like to watch, about 3 different tabs that I just closed down that were opened yesterday to search some ffxiv market item prices for a friend, WhatsApp web, some Path of exile trade live tabs in case an item I’ve been searching for a month shows up on trade in a reasonable price to pick up the game again, the medianxl ladder to check for gear on too players, 2-3 tabs for players on the ladder to check their gears as a rough template,…

    I’d say at any given time it’s a minimum of 10, and I’m not being held responsible of my work browser tabs. That’s more like, 4 github repos because they ask me about stuff and I forget to close them, hue, the spark docs on like 5 tabs, 3 google searches, several excels with project tracking stuff, and maybe an extra 10 to 20 tabs open depending of what I’m searching or have been asked about in the last 2 days.