flat assembler
Message board for the users of flat assembler.

Index > Windows > VirtualAlloc vs HeapAlloc

Author
Thread Post new topic Reply to topic
veach1



Joined: 16 Jul 2004
Posts: 165
veach1 12 May 2005, 13:13
Hello!

Advice me please, which API function best suits for creating (and managing)
13 dynamical arrays consisting of approx. 20000 elements each, every element (structure) weights not more than 1kb of data.

_________________
dream of mind creates a monster
Post 12 May 2005, 13:13
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 12 May 2005, 14:39
In my opinion you have to rethink thw whole algorithm you want to use Wink Why do you need 250 megs of allocated memory? System won't let you do this even though I guess... Your program would need at least 512 MB RAM, so I think it's a bit too much.

But if I had to decide which one to use, I would use VirtualAlloc, as it uses pagefile and is better for large amount of data. Using HeapAlloc is afaik not considered good, when playing with such big data.
Post 12 May 2005, 14:39
View user's profile Send private message Visit poster's website Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22 12 May 2005, 23:05
VirtualAlloc lets you commit large amounts of memory, while HeapAlloc allows you to reallocate. Since your array sizes won't change VirtualAlloc would be your best shot.

You may also want to look into a File Mapping Object, CreateFileMapping/ViewFileMapping you can read and write large amounts of data to the filemapping obj easily.
Post 12 May 2005, 23:05
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.