Re: XMS problems

2003-07-07 06:23:01 PM
"Femme Verbeek" <fv[at]{*word*104}jet[dot]nl>a écrit dans le message de

"Fernando Andrés Cosa" < XXXX@XXXXX.COM >schreef in bericht
news: XXXX@XXXXX.COM ...
>"Femme Verbeek" <fv[at]{*word*104}jet[dot]nl>wrote:
>>"Fernando Andrés Cosa" < XXXX@XXXXX.COM >schreef in bericht
>>news:3ee79192$ XXXX@XXXXX.COM ...
>>>I am using XMS to store data records of a TCollection. I created
>>many objects derived from TCollection and overrided the Init,
>>and Done methods for each of them in order to enable XMS support.
>>>All these objects are working properly but in one precedure I am
>>having memory problems (I think). I declared a variable of the type
>>>procedure NewProcedure;
>>>T: PNewCollection;
>>>T := New(PNewCollection, Init);
>>>T^.Something1; {This method store some elements in XMS}
>>>T^.Something2; {This methos shows data sotred in XMS}
>>>Dispose(T, Done);
>>>{Up to here the programme runs well}
>>>T := New(PNewCollection, Init);
>>>T^.Something1; {The programme stops here with a violation, so I
>>close the cmd32 Window}
>>>Dispose(T, Done);
>>>The reported error is:
>>>The instruction "0x0f00ef5b" makes reference to memory at
>>"0x01cc1400". The memory can't be "read"
>>>I am working with BP7 under Windows 2000 Professional with
>>Pack 3.
>>>Debugin step by step I couldn't find any answer. I didn't find
>>stack problem nor any heap problem. And the XMS handler doesn't throw
>>any kind of error.
>>>Somebody told me that Windows 2000 reserves a piece of memory and
>>that DOS programmes may crash with it.
>>>Thanks in advance, Andrés Cosa
>>The code looks allright to me. The problem may be caused inside the
>>something1 procedure.
>>Why do you use XMS if you have BP????
>>Why don't you compile to protected mode. This will give you 64 MB of
>>heap without problems.
>That would be grate (the 64MB I mean). The problem is that changing
that would probably require important tests in our product and we don't
have that time.
>I also created a function call AtXMS for the collections in order to
access collection items. This function simply copies the block of XMem
to CMem. It functions very well in all collections but for some reason
it is causing the problem I told you in a procedure like the one in the

It's not that difficult. I think it's worthwile to make the effort.
In the BP IDE goto Compile/target set it to protected mode application.
First try to recompile all your units.
If you make any use of direct memory addressing, look in the build in
help for the items starting with see how to solve that.
Take out the xms driver unit and strip out all the calls that make use
of it, just do your heap calls in the normal way as you would do in real

When you distribute your program you have to include
RTM.EXE and DPMI16BI.OVL with your code. This is allowed by your Borland
no nonsence licence.

Protected mode is less forgiving in having uninitialised pointers, so be


Mmm, we are using protected mode.
We don't have any memory crash on Win9x platform, but meet the same problem
running our programs on a full 32bits platform (WinNT Win2000 or XP).
NTVDM crashes with same error of non readable region.