Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: urgent question to ´MS-VC++ 6.0´ experts (Dann Corbit?)

Author: F. Huber

Date: 10:49:31 12/05/03

Go up one level in this thread


On December 05, 2003 at 13:05:57, martin fierz wrote:

>hi franz,
>
>i believe this might all be consistent: windows has different mem alloc
>functions, and the compiler translates "malloc" into one of them. so if the
>borland compiler translates it into "virtualalloc" while the MS compiler
>translates it into "heapalloc", you get exactly the kind of behavior you
>observed.
>
>if portability is not an issue, then you should use the windows functions. my
>book says you should use virtualalloc for large chunks of memory, and heapalloc
>for small chunks. heapalloc is supposed to be much slower when handling large
>amounts of memory.
>
>virtualalloc is quite easy to use, just do
>
>pointer = VirtualAlloc(0, number_of_bytes, MEM_RESERVE|MEM_COMMIT,
>PAGE_READWRITE);
>to allocate memory, and
>
>VirtualFree(pointer, 0, MEM_RELEASE);
>to free it again.
>
>cheers
>  martin

Hi again,

that looks really simple - thanks for saving me a lot of time. :)

I´ll try this, but since I´m not ´really´ a C-programmer (_my_ language
is Borland Delphi), and since I´m manipulating the source code of Heiner
Marxen, I must be _very_ carefully to not do any ´blunder´.

Regards,
Franz.




This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.