brent@well.UUCP (Brent Southard) (06/19/89)
In article <246400012@uxa.cso.uiuc.edu> mms00786@uxa.cso.uiuc.edu writes: > >Hello. > >I just got started on Windows programming, and bought a copy of Petzold's book. >As is my luck, I picked Freemem as the first program to try, and of course it >doesn't work. I have 4 Megabytes of memory, and the MSDos Exec confirms this in >the about dialog box. However, when I run FreeMem, it always tells me I have >280 K of free memory. This is what GlobalCompact (0L) returns, even after I >GlobalAlloc 280k! ... I think you are confused about what GlobalCompact() returns. Global memory in Windows is that memory within DOS' control, i.e. usually 640k. Since DOS, drivers, Windows, and your application all eat up this memory, the 280k amount you mention sounds accurate. Try running other applications at the same time, and you will see FreeMem's number drop. In order for you to get a more complete view of ALL free memory, you will need to call the appropriate EMS functions. Ray Duncan's "Advanced MS DOS Programming" is a good source for Expanded Memory details. brent -- brent southard (313) 656-8349 | oh mona mona ImageTech Corp (313) 362-3141 | you can close your eyes | i've got a twelve gauge surprise usenet: ...!well!brent | waiting for you -- James Taylor
mms00786@uxa.cso.uiuc.edu (06/21/89)
Duh, I feel dumb (please, no comments!). The answer is obviously that all that extra memory is managed by Windows/386 EMS manager. A small program to call the EMS manager and query it about the number of available pages solved the problem. Sorry, Milan mms00786@uxa.cso.uiuc.edu
mms00786@uxa.cso.uiuc.edu (07/23/89)
Hello.
I just got started on Windows programming, and bought a copy of Petzold's book.
As is my luck, I picked Freemem as the first program to try, and of course it
doesn't work. I have 4 Megabytes of memory, and the MSDos Exec confirms this in
the about dialog box. However, when I run FreeMem, it always tells me I have
280 K of free memory. This is what GlobalCompact (0L) returns, even after I
GlobalAlloc 280k! In other words, the function that I seem to be calling seems t
to be:
DWORD FAR PASCAL GlobalCompact (...
{ return 280L;
}
I am using Windows/386 on a Gateway 2000 machine. Can someone please tell me
what is going on here?
Thanks a bunch in advance,
Milan.
.brent@well.UUCP (Brent Southard) (08/04/89)
In article <246400012@uxa.cso.uiuc.edu> mms00786@uxa.cso.uiuc.edu writes: > >Hello. > >I just got started on Windows programming, and bought a copy of Petzold's book. >As is my luck, I picked Freemem as the first program to try, and of course it >doesn't work. I have 4 Megabytes of memory, and the MSDos Exec confirms this in >the about dialog box. However, when I run FreeMem, it always tells me I have >280 K of free memory. (Hasn't this same question appeared here before?) You have 4 Mb of memory, but most likely 640k of DOS (Conventional) memory. This is the memory which GlobalCompact() works with, thus the 280k being returned is most likely correct. Remember, DOS, device drivers, TSRs, and Windows itself are all sharing this memory. If you want to paint a more global picture of your memory resources you will have to make some EMS calls to determine how many free/total pages are available. brent -- brent southard (313) 656-8349 | oh mona mona ImageTech Corp (313) 362-3141 | you can close your eyes | i've got a twelve gauge surprise usenet: ...!well!brent | waiting for you -- James Taylor