Banner
Views: 1,003,254,187
Time:
19 users online: 7 up, Children's Digest 1950-2009, CourtlyHades296, Dark Prince, Donut, Fullcannon, janklorde, LuigiTron, lx5, mILANGA, Neidave,  NopeContest, Noxor, OEO6, pakkie, QuantumNate, RichardDS90, shaoshao,  Telinc1 - Guests: 86 - Bots: 250 Users: 54,835 (2,032 active)
Tip: Try sketching out ideas for overworlds and levels. Even if they don't manage to fit into Lunar Magic completely, at least you have a base to work from, instead of doing it all from scratch.
Not logged in.
I can't figure out how to use this program.
Forum Index - Donut Plains - Computers & Technology - I can't figure out how to use this program.
Pages: « 1 » Link
I found this. It's supposed to be an implementation for detecting memory leaks in C++ on Windows completely from scratch without any external tools. The problem is, there is almost no documentation, and I can't figure out how to use the example program!

If I compile it like this

Code
g++.exe *.cpp -o p.exe

and run the program, it doesn't display any memory leak information.

It also says something like running link.exe and having it generate a map file, but I don't know what it's talking about. I don't have to run any link.exe file when using GCC and adding the

Code
/MAP:example.map

to the compile command just gives me a slew of strange errors.

How do I get this working? Does anyone know?

I'd also like to use C++17. I think the article was written way before that, so I don't know if I'd have to change anything to make it compatible with C++17.

Click the character on the right side of my layout to visit my Discord server and discuss and play and look at and get updates and sneak peeks of the games and other things I'm making.

The authors of these 2 My Little Pony fan games have removed their games from the Internet.
Rise of the Clockwork Stallions has been updated! Download My Little Pony: Rise of the Clockwork Stallions DX: Director's Cut and My Little Pony: Magic Shards now! Spread this link!

The article doesn't really make it very clear, but it seems the instructions only refer to debugging applications compiled with Visual Studio specifically. That's why it mentions link.exe, that's what Microsoft's linker is called. On top of that, the instructions are also for a very old version of MSVC, so it's questionable if they're still valid today. MSVC has changed quite a bit in recent years.

So basically, for detecting memory leaks with GCC, you'll have to find different instructions.

--------------------
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
What about Valgrind? I recently bought a new computer and installed Ubuntu xfce on it so I could use valgrind and test my games on a low end computer and on a different operating system.

I used Valgrind a little in college. However, in college, I only made console programs, and I was taught to look for a message that said, "All heap blocks are free." If that message is displayed, there are no memory leaks. If it's not displayed, there are some.

However, I'm now making games using a C++ library called Simple DirectMedia Layer, and one big problem is that the library has memory leaks, so Valgrind is never going to display that "All heap blocks are free." message because, even if my code has no memory leaks, the library does. The problem is, I have no idea how to configure Valgrind so that it only looks for memory leaks in MY code. I looked online, and sources say something about suppressions, but I don't understand them at all or how to tell if an error is from my code or from the library's code.

Can you help me RPG Hacker? Do you have experience using Valgrind?

Click the character on the right side of my layout to visit my Discord server and discuss and play and look at and get updates and sneak peeks of the games and other things I'm making.

The authors of these 2 My Little Pony fan games have removed their games from the Internet.
Rise of the Clockwork Stallions has been updated! Download My Little Pony: Rise of the Clockwork Stallions DX: Director's Cut and My Little Pony: Magic Shards now! Spread this link!

The website for Valgrind says that it works on most Linux, Android and Darwin (OS X) architectures, so I think it should work for you if you're using Ubuntu. Unfortunately, I don't really have any experience with it, so I can't offer much assistance beyond that. Never had to use any external memory tracking libraries yet, as the games I work on usually include their own internal technology for that.

In fact, that's probably what I would recommend in this case as well. You could write your own simple memory allocator and use it for all the things you allocate yourself (for maximum simplicity, it could just wrap around malloc()/free() and new()/delete() so that you don't need to implement your own actual memory allocation algorithm). You could then add your own tracking code to that allocator, which would only track all of the things you allocated yourself.

Using memory allocators is very common in games, because all consoles have specific memory requirements for specific data (like textures, audio and other assets), which is usually easiest to accomplish by having a bunch of different allocators for each task. Of course this doesn't really matter for PC-only games, but it might still be common practice even there. Though of course implementing your own tracking would take a bit of time and experience, so maybe it's a bit too much for the simple game you probably want to make? Maybe figuring out how to properly use Valgrind (or another memory tracker) will still end up being easier and faster, I really don't know.

--------------------
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
What about a garbage collector? Would I even need a memory leak detection tool if I had a garbage collector? Are there any good C++ garbage collection implementations online? If so, where?

Click the character on the right side of my layout to visit my Discord server and discuss and play and look at and get updates and sneak peeks of the games and other things I'm making.

The authors of these 2 My Little Pony fan games have removed their games from the Internet.
Rise of the Clockwork Stallions has been updated! Download My Little Pony: Rise of the Clockwork Stallions DX: Director's Cut and My Little Pony: Magic Shards now! Spread this link!

I don't think you really need garbage collection for that. Just smart pointers should be enough, which the C++ STL has a bunch of (unique_ptr, shared_ptr, weak_ptr and maybe more). Those will count references on all your allocations and free them automatically when the count reaches 0.

Of course, smart pointers also have their pros and cons. I don't know how good the implementation of C++ smart pointers is, but just to give a random example: circular references could be a problem. Think of two objects that point at one another, but have nothing else pointing to them. They will keep each other from being deleted (since each still has a reference to the other), but since nothing else is pointing to them, they're no longer usable, so their memory is effectively leaked. I do think solutions for circular references exist, but I don't know if C++ smart pointers use them. I haven't worked with them a lot.

Anywasy, yes, using them might be a good idea for your use case. Since all solutions have their pros and cons, you might as well go with the one that is easiest to use for you, and smart pointers are definitely quite simple to work with.

--------------------
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
Hmm, I don't know much about smart pointers. I'll have to look up what they are and how to use them. They sound promising, though.

Click the character on the right side of my layout to visit my Discord server and discuss and play and look at and get updates and sneak peeks of the games and other things I'm making.

The authors of these 2 My Little Pony fan games have removed their games from the Internet.
Rise of the Clockwork Stallions has been updated! Download My Little Pony: Rise of the Clockwork Stallions DX: Director's Cut and My Little Pony: Magic Shards now! Spread this link!

Pages: « 1 » Link
Forum Index - Donut Plains - Computers & Technology - I can't figure out how to use this program.

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2022 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy
  • sm64romhacks