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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allocate Memory?

Status
Not open for further replies.

ug505

Programmer
Jan 2, 2010
52
US
I know this is kind of a weird question, but how do you...allocate physical memory? I know using New will make a new object but it's not allocating what I'm looking for. Here's kind of what I'm looking for:
That program allocates memory in the way I want to. How would I go about allocating around...say 500 MB? Or will VB.NET not allow this because of it's memory management?
 
I know in Delphi I would do

Code:
procedure TForm1.Button1Click(Sender: TObject);
var
FileData : TStringList;
TimeNow : LongInt;
begin
  TimeNow:=timeGetTime;
  while (TimeNow + 20000) > timeGetTime do FileData:=TStringList.Create;
end;
 
Take a look at the System.Runtime.InteropServices.Marshal class, specifically the AllocHGlobal function.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top