I am writing a game in C++ using SDL as the main library, and everything seems to be going okay. However I am noticing large memory usage when I load in a texture, and freeing up pointers/objects with delete() doesn't seem to be actually freeing up memory. So on linux I used ValGrind but I find it difficult to understand where my problems are happening.
I copied my code over and have it compiling and running under Windows using Visual Studio 2010 Pro. I notice the memory usage is the same on both windows and linux, and the memory use doesn't rise constantly but it does rise when objects are created (normal), however before creation is should be deleting the one previously taking that memory space (not freeing), and using some couts I can see that it is freeing them.
ie)
MyObject *obj = new MyObject() // results in + 200kb used
delete(obj) // Doesn't reduce memory by 200kb
obj = NULL // Just sets the pointer to null
If I kept running that my memory would constantly grow by 200kb (which I think is far more than that object should be using anyways). So to try and figure out what was going on I tried adding in the leak code as stated by MS on MSDN.
AttikClient::StartGame() initializes a static function in a static class, that has the main game loop and other logic. However when I close my program there is no leak output in the output window. I have debug on as I can step through the code and can see basic output but no leak information.
Wow, spoken like a true blind hater, you don't even provide arguments. Please, go check my comment above to @seacaptain and you'll find out why what you say doesn't make sense in this context...
Get used to this, with AI tooling now uncovering new vulns and getting them exploitable far faster than has ever been possible before software is going to need to be updated far more frequently.
Back in the day it may take reseachers weeks or months to do what AI can now do in hours.
Once its a threat is discovered it's weaponsized far more quickly, meaning you simply can't be waiting 2, 3, 4 weeks to deploy a patch, it needs to be patched immediately.
Going to be interesting handling this in the enterprise space where traditionally patching has been steady, but very staged (and rightly so up until now), that is going to have to change.
You don't need to "close all browser sessions constantly" or wait for updates to install. The updates download in the background while you use the browser, without interrupting you, they install automatically the next time you launch the app. And they install very fast (depending on your storage speeds, of course), you have to wait at most 2-3 extra seconds, if any.
Seems like you haven't used Edge in a loooooooong time...
Segra 1.6.0 by Razvan Serea
Segra is a free, open-source OBS-powered game recorder offering fast gameplay capture, instant clips, AI highlights, deep game integration, and seamless uploads—perfect for gamers, streamers, and content creators. Lightweight, fast, zero bloat.
Segra key features:
Automatic Game Recording: Begin capturing gameplay the moment your game launches, with zero manual setup.
Instant Clipping: Save important moments instantly using a customizable hotkey—perfect for highlights, montages, or quick shares.
Segra AI Highlights: Let Segra automatically detect kills, assists, deaths, and key events to generate polished highlight reels without manual editing.
Gameplay Uploads: Upload recordings and clips directly to Segra.tv for fast sharing and cloud access.
Deep Game Integration: Enjoy advanced game-data tracking across hundreds of supported titles, enabling smart highlight generation and stat-informed clipping.
High-Performance Capture: Record up to 4K at 144 FPS using OBS-powered technology with minimal performance impact, supporting NVENC, AMD VCE, and custom quality controls.
Segra Editor: Edit recordings easily with timeline controls, segment management, and event-based navigation to build the perfect clip.
Customization Options: Adjust hotkeys, output formats, storage paths, codecs, capture quality, and performance settings for a tailored recording experience.
Segra 1.6.0 changelog:
Recording: Added HDR support.
Grand Theft Auto: Added game integration for deaths (FiveM and RAGE MP supported).
Highlights: Added customizable padding for highlights.
Replay Buffer: Added a shockwave visual effect when a replay buffer clip is saved.
Audio: Increased the maximum sound effects volume from 100% to 200%.
Hotkeys: Fixed hotkeys not triggering while unrelated keys were held.
Installer: Added code signing to verify publisher identity, branded the installer, and reduced OS security warnings.
OBS: Updated the supported OBS version to 32.1.2.
Download: Segra 1.6.0 | 74.4 MB (Open Source)
View: Segra Homepage | Github | Screenshot
Get alerted to all of our Software updates on Twitter at @NeowinSoftware
Question
firey
I am writing a game in C++ using SDL as the main library, and everything seems to be going okay. However I am noticing large memory usage when I load in a texture, and freeing up pointers/objects with delete() doesn't seem to be actually freeing up memory. So on linux I used ValGrind but I find it difficult to understand where my problems are happening.
I copied my code over and have it compiling and running under Windows using Visual Studio 2010 Pro. I notice the memory usage is the same on both windows and linux, and the memory use doesn't rise constantly but it does rise when objects are created (normal), however before creation is should be deleting the one previously taking that memory space (not freeing), and using some couts I can see that it is freeing them.
ie)
MyObject *obj = new MyObject() // results in + 200kb used
delete(obj) // Doesn't reduce memory by 200kb
obj = NULL // Just sets the pointer to null
If I kept running that my memory would constantly grow by 200kb (which I think is far more than that object should be using anyways). So to try and figure out what was going on I tried adding in the leak code as stated by MS on MSDN.
http://msdn.microsoft.com/en-us/library/e5ewb1h3(v=vs.80).aspx
I put that in my main.cpp file and put the "_CrtDumpMemoryLeaks();" in my main function which looks like
AttikClient::StartGame() initializes a static function in a static class, that has the main game loop and other logic. However when I close my program there is no leak output in the output window. I have debug on as I can step through the code and can see basic output but no leak information.
I have also tried VLD (Visual Leak Detector) http://www.codeproject.com/Articles/9815/Visual-Leak-Detector-Enhanced-Memory-Leak-Detectio
And got the same results. The build mode is for sure set as debug, and I make sure to do F5 which is Debug Application. Am I missing something?
Link to comment
https://www.neowin.net/forum/topic/1155344-c-visual-studio-2010-memory-leak-tracking/Share on other sites
8 answers to this question
Recommended Posts