News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Slow building problem

Started by akalenuk, July 04, 2006, 02:43:50 PM

Previous topic - Next topic

akalenuk

Quote from: Mark Jones on July 06, 2006, 12:05:26 AM
In regards to addressing the data directly, here are some discussions on the "base + index * scale + displacement" method. It is very useful to know when working with large memory blocks:
http://www.masm32.com/board/index.php?topic=2766.msg21943#msg21943

Thanks, i'll look it through.

savage

Ossa, I think I'm the one who was trying to work out the VirtualAlloc / editbox issue, don't think we ever figured that out.

Here are my left over comparisons for edit boxes though.

I have two programs here, one is a simple program with an edit box using HeapAlloc memory, and one is using VirtualAlloc.

The virtualalloc is odd.  It doesn't usually work, which I can accept.  The odd thing is that on some machines it DOES work.  Or, it will work occasionally.  I'm thinking it's happening from a coincidental alignment of memory blocks, since I don't see any other explanation for it to "sometimes" work.

Attached the two programs in one zip file.  They are safe and won't crash or anything, so feel free to download them and do anything you want with them.

[attachment deleted by admin]

drizz

about the editbox topic...
psdk clearly states that you should use local-mem functions
on the edit handle (atleast on NT, 9x is surely different).
hence, when you set the VirtualAlloc-handle to the edit,
OS calls LocalSize() on it and fails (you can verifyy it by setting bp in OllyDbg).

VirtualAlloc-handle might work only on 9x os, i don't know.

about big initialized buffers...
you can create big binary file and use bin2obj or fda to convert it to obj,
then you can link that to exe...OR switch to poasm :)
The truth cannot be learned ... it can only be recognized.

drizz

Quote from: Mark JonesThe returned handle is also used in the CloseHandle function
this is wrong, you must use the appropriate xxxxFree counterparts. Memory handle is not a Kernel Object.
The truth cannot be learned ... it can only be recognized.

Ossa

Quote from: drizz on July 26, 2006, 04:51:53 PM
OS calls LocalSize() on it and fails (you can verifyy it by setting bp in OllyDbg).

@drizz

Nice to know the reason, thanks

@General thread topic

This illustrates why the Virtual* functions are not always the best choice and why I said that they can "lead to complications". The most appropriate set of memory functions should be used every time.

Ossa
Website (very old): ossa.the-wot.co.uk

Mark Jones

Quote from: drizz on July 26, 2006, 05:31:36 PM
Quote from: Mark JonesThe returned handle is also used in the CloseHandle function
this is wrong, you must use the appropriate xxxxFree counterparts. Memory handle is not a Kernel Object.

This is correct, thanks for catching that brain fart. Use GlobalFree instead of CloseHandle to free that memory.
Re: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalalloc.asp
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08