Hello everyone,
In my program, I have to define many pointers and when I want to
compile my program (in UNIX), it gives me the following error:
terminate called after throwing an instance of 'std::bad_alloc '
what(): St9bad_alloc
Abort
I rechecked those pointers; I found I cannot decrease the size of them.
Any idea how I can to solve this problem?
Thanks,
Mohsen 14 29116
Mohsen wrote:
Hello everyone,
In my program, I have to define many pointers and when I want to
compile my program (in UNIX), it gives me the following error:
terminate called after throwing an instance of 'std::bad_alloc '
what(): St9bad_alloc
Abort
I rechecked those pointers; I found I cannot decrease the size of them.
Any idea how I can to solve this problem?
Are you saying your compiler terminates? If so, ask your compiler
vendor.
If you are talking about your program, then you don't have sufficient
memory to allocate whatever you are trying to allocate. If you can't
decrease the size of what you are allocating (or otherwise provide
enough space) and can't add more memory to your computer, then you're
sunk.
Cheers! --M
Mohsen wrote:
Hello everyone,
In my program, I have to define many pointers and when I want to
compile my program (in UNIX), it gives me the following error:
terminate called after throwing an instance of 'std::bad_alloc '
what(): St9bad_alloc
Abort
I rechecked those pointers; I found I cannot decrease the size of them.
Any idea how I can to solve this problem?
Without seeing your code it's impossible to tell what is going on.
I have no idea what you mean by "cannot decrease the size".
"Mohsen" <ja*******@gmai l.comwrote:
In my program, I have to define many pointers and when I want to
compile my program (in UNIX), it gives me the following error:
terminate called after throwing an instance of 'std::bad_alloc '
what(): St9bad_alloc
Abort
During the compile, or while your program is running?
--
To send me email, put "sheltie" in the subject.
it happens during the compile.
Daniel T. wrote:
"Mohsen" <ja*******@gmai l.comwrote:
In my program, I have to define many pointers and when I want to
compile my program (in UNIX), it gives me the following error:
terminate called after throwing an instance of 'std::bad_alloc '
what(): St9bad_alloc
Abort
During the compile, or while your program is running?
--
To send me email, put "sheltie" in the subject.
Mohsen:
it happens during the compile.
First guess would be that your compiler is running out of memory. Try closing
as many applications as possible, then try re-compile.
Second guess would be that your compiler is broken... but I don't see how a
bug could result in the throwing of a bad_alloc.
--
Frederick Gotham
Frederick Gotham wrote:
but I don't see how a
bug could result in the throwing of a bad_alloc.
int main()
{
for( ;; ) int *p = new int;
}
Cheers! --M
mlimber:
>but I don't see how a bug could result in the throwing of a bad_alloc.
int main()
{
for( ;; ) int *p = new int;
}
Touché!
--
Frederick Gotham
mlimber wrote:
Frederick Gotham wrote:
>but I don't see how a bug could result in the throwing of a bad_alloc.
int main()
{
for( ;; ) int *p = new int;
}
Cheers! --M
Compiles fine on mine!
--
Bill Medland This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Asfand Yar Qazi |
last post by:
Hi,
Just wondering, if I do a:
std::set_new_handler(std::terminate)
I won't have to worry about a std::bad_alloc being thrown when I do a
'new ...' or a 'new(nothrow) ...', right?
Its just that I'm writing a Ruby extension, and I tried wrapping C++
|
by: Stephan |
last post by:
why does the following code not work????
after compiling and running it will just say killed after all my memory
filled up
any suggestions?
#include <iostream>
using namespace std;
void out_of_mem() {
|
by: Gary Wessle |
last post by:
Hi
I am getting this error when running a very similar code like the
below, it is made for illustration only.
thanks
***************************************
**************** error ****************
(gdb) n
|
by: schizoid_man |
last post by:
Hi,
I have the following code snippets and I get a std::bad_alloc error
where I think there should be none. I've attached the relevant bits of
the base class, derived class and the .cpp file containing the main()
method.
I'd really appreciate any help in getting this error sorted out.
Thanks,
|
by: sndive |
last post by:
Do linux kernels 2.4 and 2.6 have some stash of memory set aside to
handle paging in std::bad_alloc
or ... exception handling code when new or new throws that exception?
How is that handled? Does gcc generate some report to the elf loader
that the largest exception
handling section is x kb long or what?
| |
by: jyothiusha |
last post by:
terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
Aborted
could anyone help me in this?
//mst.cpp
#include <iostream>
#include <fstream>
|
by: Alerion |
last post by:
Hello everyone,
I've been a regular of this forum but this is my first post, generally I can find the answer to my question already, but this time I'm having a somewhat specific problem.
For fun I've been working on making a 3d game (who hasn't haha) and while it's nothing special at the moment I was making some decent headway. I'm working on constructing an octree for my triangle data, but I keep getting this pesky bad_alloc runtime...
|
by: upadhyad |
last post by:
Hi everyone !!
i have an interesting problem...hope you people can help.
I am coding in C.
the code is posted below:
here I have a structure with two character vectors.
I have to characters. in them depending on a text file. Arround 76,000 characters in each of them one after the other....But i am not able to do so...the program runs fine for small data...but with these 76,000 characters pushed in each vector one after the other causes...
|
by: Kaio Vieira |
last post by:
Hello,
I have a "std::bad_alloc" problem when I try to run a simple C++ program on HP-UX. I don't know if it is a memory limitation or maybe a compiler option that I should use. When my program reaches 700M, it aborts.
I'm using gcc to compile.
This is the source:
#include <stdio.h>
#include <unistd.h>
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 project—planning, coding, testing, and deployment—without 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |