Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with RAM in Visual Basic 1

Status
Not open for further replies.

Paladyr

Programmer
Apr 22, 2001
508
US
Anyone know anything about working with what is stored in RAM in Visual Basic code??? I'm just curious how those programs work that clear out RAM.
 
All variables declared and data assigned to them in code will be held in RAM. When the application ends, the RAM will be given back to the system.

Chris Dukes
 
Well, i was curious as to how a program like MemTurbo and the like "clear out" the ram... Do they interact directly with it or do it some other way??
 
It depends on what the application was written in.

In VB, you declare aa variable as follows:

Dim xxx as string

This will allocate an area of RAM to hold a string. when you assign a value to the string:
ie

xxx = "this is my test"

the data will be put into RAM.

You now have the added complication of the scope of the variable.

If the variable is a global, the RAM will be the HEAP. This is the global area of memory assigned to an application.

If on the other hand, the variable is a local variable, it will be placed on the STACK. Once the current function has finished, the stack used by it is cleared ( and hence the memory can be used again).

Other languages have different methods of declaring and maintaining variables.

Applications like MemTurbo (I don't actually know what it is?) Will use the WINAPI to directly access areas of memory.


Hope this helps,

Chris Dukes
 
That's what I'm looking to do... access what is already in RAM, not variables.... instead I want to be able to see the contents of the RAM... manipulate it etc...
 
There are many API functions that allow you to look at memory, look up the following in MSDN:

GetProcessHeap,
HeapCompact,
HeepFree,
VirtualQuery,
readProcessMemory etc.

BEWARE though, changing or manipulating memory directly could (and probably will) cause your system to become unstable and crash.

Chris Dukes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top