Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ function memory usage

Name: Anonymous 2006-11-29 1:41

In order to compare various sorting algorithms, I am looking for a way to see how much peak memory a function uses. Figuring out the time they take to complete is easy, but this has stumped me. Anyone have a clue?

Name: Anonymous 2006-11-29 1:49

valgrind or wrap that shit yo

Name: Anonymous 2006-11-29 2:08

Thanks for the heads up on valgrind. Guess i shoudla clarified, I need to get the memory usage from inside the program itself, not an outside tool.

Name: Anonymous 2006-11-29 4:37

Unfortunately, the C/C++ standard library is crap and does not include a standard function to determine free/used memory (Keep it portable! Maybe some platform doesn't use memory!). You'll need to check for either a non-standard function provided by your compiler (look for mem, core, memory, free, etc.) or a function provided by your OS (careful with that though; prefer private bytes to working set size). Then you measure memory used before running the stuff, and the maximum of the memory used in each iteration.

Name: Anonymous 2006-11-29 4:39

>>4
BTW, I forgot to clarify: concentrate on used memory. "Free" memory is not a simple concept in virtual memory OSes. Even used memory can include or exclude shared memory (for you it'll be the same) and it can refer to the total size of your virtual memory map (not too accurate for you), the private bytes used by you (this is what you need), the working set (in-RAM bytes) used by you (careful with this), and the swapped bytes (out of RAM bytes from your virtual memory space, not useful for you).

Name: Anonymous 2009-01-14 13:54

FAGGOT

Name: Anonymous 2009-01-14 13:57

WHY DONT U KEEP A RECORD EVERYTIME U NEW AND DELETE

Name: Sgt.Kabu쑈⭽kimanڨ拻 2012-05-28 21:18

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List