Hi,
I'm writing image processing program on BCB. But, for huge amount of memory allocation BCB doesn't works properly.
I want to allocate nearly 2 GB (total) dynamic arrays. For 1,5 GB there is no problem. But when this size incresing it gives bad allocation error.
In that computer there is 2 GB physical memory and I use WinXP (and I add /3GB to boot.ini).
For testing I wrote an Visual C++ code in another PC which has 1 GB phyisical RAM. In the below code Visual C++ can allocate 1600 MB memory. But this code can allocate only 794 MB on BCB. What can I do? Please help... -
DWORD dwSize = 1024*1024*1600;
-
LPVOID pvBase = VirtualAlloc(NULL, dwSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
-
if (NULL != pvBase)
-
{
-
//For test only...
-
LPBYTE MyPointer = (LPBYTE)pvBase;
-
MyPointer[0]=15;
-
MyPointer[1]=20;
-
}
-
else
-
{
-
// GetLastError
-
}
-
VirtualFree(pvBase, 0, MEM_DECOMMIT);
-
VirtualFree(pvBase, 0, MEM_RELEASE);
-
-
pvBase = NULL;
-
1 2244 Banfa 9,065
Recognized Expert Moderator Expert
I assume BCB is Borland C++ Builder?
Try allocating your memory in smaller chunks, if necessary create an ADT (abstract data type) that allows you to access the chunks as if they where a single array.
Alternitively 2GB is rather a lot of data to hold in memory, put it in a file, make the file MemoryMapped and again create an ADT to access it as though it where an array.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Henrietta Denoue |
last post by:
Hi
I am new to C++ and suffering from dynamic allocation.
I have a function that returns an integer pointer and
want to assign this to another pointer:
class cssReader
{
public:
|
by: fix |
last post by:
Hi all,
I am writing a program using some structs, it is not running and I
believe it is because there's some memory leak - the debugger tells me
that the code causes the problem is in the malloc function.
Is there any general rules that tell me when to allocate memory?
I thought I don't have to if it is a variable that's not a pointer, and
I have to if it is.
I am a bit confused about the arrays particularly.
In normal situations,...
|
by: Johnathan Doe |
last post by:
Why is is necessary to write a function that allocates memory for, or
changes, a pointer to a char array using char** instead of char*?
E.g.
void modify_string( char** string )
{
if( string == NULL )
return;
|
by: Vasil Buraliev |
last post by:
Hallo. I started a solution in VS.NET with template for C# windwos
application. The solution has several projects:
-Artifacts
-BusinessRules
-Client
-ErrorLog
-Standardization
....
...
..
|
by: Tod Birdsall |
last post by:
Hi All,
The organization I am working for has created a new corporate website
that used Microsoft's Pet Shop website as their coding model, and
dynamically served up content, but cached each page by content ID. The
site appears to be working well. It is hosted on a Windows 2003 server
with 2 Gigs of RAM. It was built using Visual Studio .NET 2005 and us
running under the .NET Framework 2.0 Beta
The Issue :
| |
by: Daniel Walzenbach |
last post by:
Hi,
I have a web application which sometimes throws an “out of memory”
exception. To get an idea what happens I traced some values using performance
monitor and got the following values (for one day):
\\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During
Execution: 7
\\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
|
by: allanallansson |
last post by:
Hi i would like some guidelines for a experiment of mine. I want to
experiment with the swap and ctrl-z in linux. And for this i want to
create a c program that allocates almost all the free memory resources.
So far i have tried to use
#include <stdio.h>
int main() {
int *ip;
|
by: pereges |
last post by:
ok so i have written a program in C where I am dealing with huge
data(millions and lots of iterations involved) and for some reason the
screen tends to freeze and I get no output every time I execute it.
However, I have tried to reduce the amount of data and the program
runs fine.
What could possibly be done to resolve this ?
|
by: charlie |
last post by:
I came up with this idiom for cases where a function needs a variable
amount of memory for it's temporary storage so as to avoid constantly
mallocing. It makes me feel a little uncomfortable to have unfreeable
(but still technically reachable) memory hanging around but it is, I
think still a useful thing to do:
void fn(int *stuff, int nstuffs)
{
static int *temp_stuff = NULL;
static int ntemp_stuffs = 0;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |