Thomas Sampson


1 Comment

Which RAM?

Last night I found a useful tool from Crucial Memory which neatly scans your system (PC or Mac) to check what kind of memory it uses / requires. I was surprised at how quickly it ran and it shows you in detail, how many ram slots you have, what memory is currently in each slot, and how much can physically be added. Of course the results page does highly recommend crucial products (no surprise there), however the information given is more than enough to go and find your ram elsewhere if you wanted. Here’s the link, it will run as a browser plug-in OR a separate application download ( 220kb ) with results displayed “in browser”.

http://www.crucial.com/systemscanner/


2 Comments

ZeroMemory – What and why

Zero Memory is a Macro used within c++ programs to “Zero” some memory but what does this mean?!

Basically, here is an example of using ZeroMemory, it takes 2 parameters, a memory location and a length

ZeroMemory( &myVar, sizeof( myVar) );

So we pass in the memory location of a variable (using the & symbol to give the location of the variable and not the variable value itself) and a length (if myVar was a char lets say, then the value here would be 1).

For the example above, when this is run it will point to the location of myVar specified within memory and for the next 8 consecutive memory positions, store the value 0. so at memory position &myVar the contents of memory will now be

“00000000b”

Why?

This is mainly used when variables have not been initialised. For example if you declared a string variable in c++ but gave it no initial value, it will have a location in memory, but no value of its own, in some situations it will be pointing to random values held in ram which have not been cleared previously. Then when you try to cout << stringVar it will most likely crash depending on the data held at the position of the uninitialised variable.