Board index » cppbuilder » Different malloc() memory limits in Borland C++ and Microsoft C++

Different malloc() memory limits in Borland C++ and Microsoft C++


2004-05-21 09:37:13 PM
cppbuilder60
On my Windows2000 system with C++Builder 5 there are about 1500 Megabyte of
RAM installed.
In my application I'm trying to allocate a huge sized buffer for video
frames.
Therefore I'm using:
::GlobalMemoryStatus() to determine the avaiable free RAM and
malloc() for buffer allocation.
The maximum buffer size where malloc() returns an valid pointer differs for
the three following cases (e.g. 960 MB of RAM are free/valid):
a) In an VisualStudio sample application: Max size = 960 MB
b) In an C++Builder sample application: Max size = 480 MB
c) In an VisualStudio-generated DLL loaded in an C++Builder sample
application: Max size = 320 MB
Question:
How can I use all free RAM for allocation in C++Builder Application (direct
and via DLL)?
Which configuration has to be done in C++ Builder?
Other allocation routines better?
Any remarks are highly welcome.
Ralf
 
 

Re:Different malloc() memory limits in Borland C++ and Microsoft C++

On my Windows2000 system with C++Builder 5 there are about 1500 Megabyte of
RAM installed. In my application I'm trying to allocate a huge sized buffer
for video frames.
Therefore I'm using:
::GlobalMemoryStatus() to determine the avaiable free RAM and
malloc() for buffer allocation.
The maximum buffer size where malloc() returns an valid pointer differs for
the three following cases (e.g. 960 MB of RAM are free/valid):
a) In an VisualStudio sample application: Max size = 960 MB
b) In an C++Builder sample application: Max size = 480 MB
c) In an VisualStudio-generated DLL loaded in an C++Builder sample
application: Max size = 320 MB
Question:
- How can I use all free RAM for allocation in C++Builder Application
(direct and via DLL)?
- Which configuration has to be done in C++ Builder?
- Other allocation routines better?
Any remarks are highly welcome.
Ralf
 

Re:Different malloc() memory limits in Borland C++ and Microsoft C++

Quote
How can I use all free RAM for allocation in C++Builder
Application (direct and via DLL)?
You can not use all free RAM for allocation in any program. That is
not related to what compiler that was used or if the call to get the
memory is in a DLL or in an EXE.
You might adjust the Max Heap Size Under Project|Options|Linker.
However I think you should also look at and possibly adjust the
process working set size independent of what compiler is used.
GetProcessWorkingSetSize
SetProcessWorkingSetSize
When working under Win 2K and above I prefer using
GlobalMemoryStatusEx instead of GlobalMemoryStatus. It doesn't seem
to sometimes get confused by other programs (such as SQL server).
Quote
Other allocation routines better?
You might try HeapAlloc.
. Ed
Quote
ralfvo wrote in message
news:40ae060e$ XXXX@XXXXX.COM ...

On my Windows2000 system with C++Builder 5 there
are about 1500 Megabyte of RAM installed.
In my application I'm trying to allocate a huge sized
buffer for video frames.
Therefore I'm using:
::GlobalMemoryStatus() to determine the avaiable free
RAM and malloc() for buffer allocation.

The maximum buffer size where malloc() returns an valid
pointer differs for the three following cases (e.g. 960 MB
of RAM are free/valid):

a) In an VisualStudio sample application: Max size = 960 MB
b) In an C++Builder sample application: Max size = 480 MB
c) In an VisualStudio-generated DLL loaded in an C++Builder
sample application: Max size = 320 MB

Question:
How can I use all free RAM for allocation in C++Builder Application
(direct and via DLL)?
Which configuration has to be done in C++ Builder?
Other allocation routines better?
 

{smallsort}