News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

variable in .data? section vs heap

Started by bsdsource, January 14, 2014, 06:50:43 PM

Previous topic - Next topic

bsdsource

In my project I currently use the following variable:

.data?
     buffer_memory dd 40960 dup (?)


Would it be better to use the heap api commands and allocate memory like that, or is this method fine?

jj2007

It's fine, shorter and faster. Watch out for a bug in Masm (2. Assembly gets slow...)

bsdsource


hutch--

Do yourself a favour, get used to using allocated memory, its a lot more flexible and you can start and end it on the basis of need. Either initialised or uninitialised data sections are useful for relatively small amounts of memory when you need GLOBAL scope with the data or space enclosed in either but dynamic allocation can do a lot more in a much more flexible way.

Force

what about  reading file ?

i use like that

invoke GlobalAlloc,GMEM_MOVEABLE or GMEM_ZEROINIT,(1024*1024* 8 )

if i use like that

invoke GlobalAlloc,GMEM_MOVEABLE or GMEM_ZEROINIT,nFileSize

after deleting any item from file my project crashes  :dazzled: