Programming :: Terminate Called After Throwing An Instance Of 'std::bad_alloc'
Jul 13, 2010
I have written a code in which i have used vectors:
vector< vector<double> > arr;
arr.resize(x,vector<double>(x,0));
x is a variable which is taken from a very beg text file > 64MB
first line of my code is
cout<<"
Wait Running...";
my code takes text file as an input, takes its data and generates an output text file....
Code is running fine for small data tried till x= 10
but while trying to run with large data ie x = 5000000 approx it is giving error
Even the first line of the code is not displayed. NOTE: variable is declared global but its size is defined in main.
The error that i am getting after approx 2-3 minutes is:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Wait Running...Aborted (core dumped)
View 6 Replies
ADVERTISEMENT
Jan 28, 2010
I have a program suffering from bad memory allocation :
The Problem is I get "terminate called after throwing an instance of 'std::bad_alloc' what(): St9bad_alloc " error when I try to create huge numbers of packets in my program, I am using Message-Size from the trace file to determine the numbers of packets to be created for each object node, I am creating a mesh of 16 nodes here, which communicate to each other. With small number of messages the program runs fine. I am not sure if "delete previous" is the right way to free the memory..
View 3 Replies
View Related
Jul 13, 2011
I feel there's a bit of a misunderstanding going on between C++ and me...My problem is that I have a deque of pointers to a class, and create objects then add them to the deque in a for loop. However, the destructor is called on the object as soon as the loop quits.
Code:
This prints:
Code:
Now, if I change the deque from deque<Test*> to deque<Test> then it works fine - I get:
Code:
However, I can't do this with my actual code, because I am creating a deque of pointers to an abstract class, so it won't let me instantiate the class. (This is all so that I can take advantage of polymorphism, and call functions on a set of similar objects without worrying what type of object I'm dealing with).
So, I suppose my question is: what is the correct way to create that deque of pointers to the abstract class? I don't seem to be barking up the right tree currently.
View 4 Replies
View Related
Nov 21, 2010
I have a script that starts a subshell
Code: #!/bin/sh
local SSPID
clean_exit() {
[Code]....
done so the script waits in the loop for the subshell to finish then does processing and starts over. If I kill the script the subshell is not killed. So I can trap the TERM event and do some cleaning but I need to know the subshell process id.
I'm using busybox so ps does not accept any parameters I cannot source subshell so it can access its parent environment
View 2 Replies
View Related
Jun 2, 2010
changed terminal into raw modecfmakeraw(&termios);After that terminal no more captures CTRL+CIs there a way to enable CTRL+C (to terminate the program) while still have RAW mode?
View 3 Replies
View Related
Feb 15, 2011
The following command would remove the leading astericks, spaces, slashes, tabs and is present in an awk script.
Code:
gsub(/^[/* ]*/,"")
The above code is working fine when i run in Cygwin on windows machine. But when i run in Ubuntum throws the following error.
Code:
awk: ./Format.awk: line 30: regular expression compile failed (bad class -- [], [^] or [)
^[
awk: 30: unexpected character ''
awk: ./Format.awk: line 30: runaway regular expression /,""); ...
View 2 Replies
View Related
Apr 27, 2010
I can define all variables in tcl programming in a file for instance var.cfgand source the same file in my tcl script such assource var.cfgIs this possible in perl too?
View 3 Replies
View Related
Feb 15, 2010
I have KDE 4.4 and Firefox 3.6. Whenever I click a link from a plasmoid widget, it tries to open Konqueror and another instance of Firefox. The page actually loads in the opened Firefox window, but the task bar shows an instance of Konqueror and another instance of Firefox, that keeps loading for a while then close. See image below:
I currently have setup the browser default application as "firefox". If I set this option to use the default application, it opens in Konqueror and I don't see additional windows in the task bar. If I change the option to "firefox %u", then it exhibit the same issue, but the process is much faster, so the loading windows don't stay for long in the task bar. Additionally, it opens the link on a new Firefox window and opens the page twice. Although Konqueror is not loaded, the bouncing icon next to the mouse pointer shows up and stay for a while.
View 1 Replies
View Related
Apr 6, 2011
I have two classes, for argument's sake A and B. A implements the core functionality, B is an encapsulated data structure. If you imagine this situation
[code]...
From within B's member functions, I would like to access the public function() in class A. This is not an inheritance issue, they are two discrete classes with radically different functionality. Class A makes an object of B.
View 5 Replies
View Related
Sep 12, 2010
I have a bash script which is called automaticallyI want it so that if when the script is called if a previous instance of it is already running then to delay the running of it until the previous instance has stopped (effectively queue up ./script.sh var1 var2)I have seen some posts about a 'lockfile' but this just seems to stop the second instance running rather than queueing it up to run next (it also needs to be able to queue up a 3rd/4th calling of the script and run them one at a time)
View 14 Replies
View Related
Nov 27, 2010
I'm wondering about this kind of GUI Interfaces like Slackware setup program
What is called ? Also, Can it be used with Python?
View 6 Replies
View Related
Dec 11, 2010
I need to write a shell script that will be run from cron every minute or so. The script will use rsync to keep some folders across several machines in sync. I am very new to shell scripting so some answers might seem obvious but they are not to me:
1. How do I check at the beginning of the script if the script is already running and abort if it is? I saw that most processes use a PID file for that but I am not sure this is the right case for that and in fact how to do it exactly
2. Assuming the list of target machines/dirs to sync are supposed to come from some config file. How should I code that? Just use the normal shell tools that I already know (cut etc) or is there a better way?
View 6 Replies
View Related
Apr 6, 2011
The intent here takes a little background info.I'm trying to make a basic inventory control to reinforce my studies. It will have a while loop that displays amenu for add, edit, view, and quit. Lets assume the following:
Code:
class inventoryItem:
itsDescriptiveName = None
[code]....
View 5 Replies
View Related
Jan 6, 2010
I have our own C written program code which is communicating with a third party C++ written program code to run a moving device. We have successfully communicated with the third party code with wrapper functions. (Thanks to member in LQ that helped me solved this.)Now, we tried to run some functions to move the device. I think it is better for me to attach the related code first. pro.c (The source code we used to run the device)
Code:
#include<stdio.h>
#include "wrapper.h"
[code]....
View 7 Replies
View Related
Feb 14, 2011
What is the Terminology called of a Binary using a file that is not part of it's self? An example would be when a browser uses a HTML file for it's interface. The binaries code has to know how to find it and so on. I imagine that the applications binary uses a system call and that another application takes over.
View 1 Replies
View Related
Sep 3, 2010
I suspect this will be beyond my abilities but thought I'd give it a try. A few months ago I wrote code for an application called nagios which would send me tweets when a system within my network ran into a problem (code below):
Code:
define command {
command_name notify-host-twitter
[code]....
View 7 Replies
View Related
Oct 11, 2010
I thought about this a while ago when reading through a Python tutorial and I googled some and couldn't find an answer. Now I want to know it for Ruby, also, and it's more important now because I want to invoke Ruby with -w.
How can you use:
Code:
with a -w option to ruby, like:
Code:
This doesn't work and I can't find an explanation of how to do it.
Code:
View 1 Replies
View Related
Mar 18, 2010
Script programming question for the experts. I have written a bash script that works fine if I execute from the shell interactively. However, once I schedule it to be executed via cron, it just wouldn't work. I believe this has to do with cron running in a different environment than the one I am in when I putty in.
The bash shell script does refer to environment variables in the .cshrc file. I guess these aren't available to the cron? How can I load them into the script if I want them to be available to the cron locally within the script?
View 1 Replies
View Related
Oct 6, 2010
I've written a simple perl code to learn switches in perl.My code is pasted below,
#!/usr/bin/perl
$opt = 1;
switch($opt) {
[code]...
View 3 Replies
View Related
Mar 20, 2010
what are the series of files that are called when a user make copy operation from usb mass storage to hard disk?i have reached the code of the usb mass storage in linux kernel 2.6.33 and i want the exact code the make the copy how can i do that?
View 2 Replies
View Related
Mar 2, 2011
I am using Debian linux. I have 100 timers running. If a timer expired which will generate a signal and it was mapped to a same function handler. All the timers are mapped to one function handler. The problem is if the timer expires one at a time, the function handler called at a time. But if the 2 timers expires at a time, the function handler is called one time only instead 2 times. Is it possible to invoke the function handler as many times based on timer expirary happens simultaneoulsy?
View 14 Replies
View Related
Jul 7, 2009
I wanna write a file in kernel space but from my searching I can to know that instead of writeing file in kernel space ,I can write data to user space by copy_to_user space.
But link is missing ...I dont know how will my user space will access kernel space means my function in kernel space which will do copy_to_user /....How my user space function will call my kernel level function ..
Can any one of you provide me with some example file which are doing this .I know every char driver is using it ...but i could not trace back how user level function is accessing it ...i m confused between user space and kernel space.
View 2 Replies
View Related
Mar 3, 2011
I have a machine running Fedora 14 and a bunch of movies stored on it as '.iso' images. It is connected to my home theater. I used to use VLC to play these movies and it worked great for a long time. About 4 months ago, about an hour or hour-and-a-half into a movie, the audio suddenly "disappears" and the machine goes CRAZY with almost 100% of the CPU spent writing to the SWAP. At first I thought the machine was locked, but it isn't; it's so doggone busy writing swap. I am unable to get enough cycles to terminate anything. I found the swap activity through System Monitor - it was ABRUPT. Sound stopped, machine became preoccupied with swap.
I have removed/reinstalled VLC, the machine has undergone a couple kernel updates, and I have removed/reinstalled a number of things associated with audio (CD ripper, mpeg stuff, etc.) yet the problem persists. I don't know what happened or when (update-wise). Any body got any ideas? While a solution would be great, I'd also be happy with a couple decent suggestions on what to look for.
View 3 Replies
View Related
May 28, 2011
Just now Rhythmbox has stopped working. I can't restart it, so I thought I could kill the process to start it again. Is there something like the windows task manager in openSUSE or another way to list all processes and to kill one? I googled an found a few old threads saying that there is a performance monitor which is able to to that, but I can't find that either.
View 7 Replies
View Related
Dec 10, 2010
I have an issue with my web server. We are running RedHat Enterprise Linux 3.0 with Apache 2.0 and Tomcat 5.5. The situation has arisen that the httpd sessions never terminate. New connections continue and continue to be created and never die. I have restarted the apache services to reset the connection and have even rebooted the server, however, to no avail. Yes, that does the trick of getting the web sites operational, however, this is not a solution.
I have searched and searched here, www.google.com/linux to no avail. I have looked through the apache.org bug tracker and can't find anything like what I am experiencing. This happened 6 months ago and I got lucky and it stopped, however, the situation has resurfaced. I have reviewed the logs and found nothing that provides any insight.
During the business day, the number of httpd connections continue to grow and I decided to let it see how high it would get before the web sites would crash. That magical number is 203. Now that it is later in the evening and about 2 hours since I restarted the httpd services, I now only have 59 connections. However, I'm fairly certain based upon the traffic on these 2 websites, that in the evening, there aren't many connections after 2000 hours.
View 3 Replies
View Related
Jan 15, 2011
I had Ubuntu 10.04 installed entirely on my 750 gig SATA drive. Yesterday I backed up my /home and installed a 200 gig drive and reinstalled using the 200 gig drive as / and swap. The 750 gig drive was all /home. Now, whenever I reboot it comes up saying it had serious errors mounting /home and I have to reboot again to get it to boot up. I never had this issue when the 750 gig drive was running the entire show. Has anyone else run into this? S.M.A.R.T. hasn't been throwing any warnings or errors so I am at a loss as to what "serious" errors Ubuntu could be running into.
View 3 Replies
View Related
May 18, 2011
My Server is not booting up throwing the error
Code:
Supervise:fatal:unable to start log/run :file not exist
and in single user mode also i'm not able to get the bash prompt same error is repeatedly coming ,this error comes up after i rebooted my Box
View 2 Replies
View Related
Sep 22, 2010
I want to block some ips permanently ie. even I as the root user cannot unblock these ips without having to format the whole system.
So i thought if some blocking software provided passwords for editing rules and I put a 'junk' password there and so that I can't delete the rules without the 'junk' password which I don't know.
So I examined iptables and I saw that it is a kernel module so there is no use of that since I can probably throw it away.
But the basic question is to block ips and gulp the key.
View 5 Replies
View Related
May 18, 2009
I have some institutional sw that requires Sun JRE and is throwing the following error during install:
blah blah agent has been designed for the Java Runtime Environment provided by Sun Microsystems. It can be downloaded at no charge from url.
Your machine is currently using GNU Java Runtime Environment.Please modify the system environment to use Sun JRE.
If you have already downloaded the Sun Java make sure that it appears *before* GNU Java in the PATH environment variable.
I dl'ed and installed jre-6u13-linux-x64.bin, but how do I make sure it's first in the PATH? Because I still am unable to install the sw.
View 3 Replies
View Related
May 9, 2011
I'm using tigthvnc server on linux machine. Often my clients are closing their vncviewrs from close button ('X'), and not exiting gracefully their sessions from OS. How can I terminate the server when they do that?
View 1 Replies
View Related