Programming :: 32-bit Executable Getting St9bad_alloc @ 3GB Mem Allocation

Jan 13, 2010

I'm maintaining a c++ application running on a 64-bit RHEL5 server w/32GB ram, but compiled to be a 32-bit executable with g++. The application handles large amounts of data, and has lately been throwing a st9bad_alloc exception. "top" shows the application as dieing right around when VIRT=~3GB, SWAP=~1.5GB and RES=~1.5GB. In the core dump I can see that it's consistently failing to push_back() a piece of data onto a std::vector (which already has hundreds of thousands of objects in it).

I know 4GB is the maximum address space for 32-bit applications. I've learned from this lwn article that a 32-bit kernel reserves 1GB of address space, leaving 3GB for user space. However I'm not running a 32-bit kernel, so that really doesn't answer anything.I wrote a dummy app which called malloc() over and over in a for loop, and it is able to allocate right up to the 4GB before it fails. I don't understand why this one seems to be able to allocate more.

The only difference between the two apps (besides malloc vs std::vector:ush_back), is that the 3GB crashing application attaches to 512mb of shared memory.Anyone have any ideas why this application would be crashing at 3GB? Is there any more diagnostics I should be doing? I would ultimately like to port this to 64-bit for a number of reasons, but it is a big undertaking for my organization, and I'd like to better understand what's going on here.

View 3 Replies


ADVERTISEMENT

Programming :: Std - Bad_alloc' What() - St9bad_alloc

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

Programming :: Process Memory Allocation

Apr 30, 2011

I have been assigned a school project on detecting memory leaks in linux processes. I am reading.. but have found it hard and inefficient to go through the very vast documentation not knowing what to really look for. Could you please give me some guidelines on this subject?

View 4 Replies View Related

Programming :: Memory Allocation For Struct In C++?

Mar 30, 2010

How do we allocate memory of struct? what i did was

Code:

int main()
struct amp
{

[code].....

cout <<"The size of 'struct' is"<< sizeof(struct amp)<<"and it is located at"<<struct amp*s = malloc(sizeof(struct amp))<<endl;
it gives me an error---
In funtion 'int main()':
error: expected primary-expression before 'struct'
error: expected ';' before 'struct'

View 9 Replies View Related

Programming :: Explorations In Memory Allocation In ANSI C?

Feb 8, 2011

I'm performing some explorations in terms of memory allocations in ANSI C, using the following compiler:

gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

and I started to try to make the compiler complain for a huge data structure, so I coded this:

[code]....

I mean, I can always read the man entry for gcc but I rather ask because I can then have interaction...

View 11 Replies View Related

Programming :: Didn't Change The Original Value Of The Pointer It Was Trying To Use For Allocation?

Feb 8, 2011

A friend working in HPC environments commented me that he had an issue regarding the use of the malloc() function.What issue?He told me that he has had cases in where malloc() instead of returning a NULL pointer on failure, simply didn't change the original value of the pointer it was trying to use for allocation, thus forcing him to initialize pointers to be allocated with malloc() to NULL, so that he could be sure that if malloc() fails, a test for NULL would make sense.

View 12 Replies View Related

Programming :: The Continuous Memory Allocation Is Larger 128kB For DMA Process?

Jun 3, 2010

I want to allocate the continuous memory larger 128k for DMA process. But i can't used kmalloc() function for allocate the memory larger 128KB. allocate the continuous memory larger 128k for DMA process.

View 1 Replies View Related

Programming :: Write Script To Look For The Presence Of Memory Allocation Calls Without Corresponding?

May 14, 2011

I need to write script to look for the presence of memory allocation calls without corresponding calls to free the memory

View 5 Replies View Related

Programming :: Processor Priority Level For Algorithm For Buffer Allocation

Jan 9, 2010

The algorithm for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool. In the algorithm getblk, if the kernel removes a buffer from the free list, it must raise the processor priority level to block out interrupts before checking the free list. Why ?Where can i find the C implementation of the above algorithm for buffer allocation in the linux source code ?

View 1 Replies View Related

Programming :: Cpu Time Taken By An Executable To Run ?

Jun 2, 2010

I want to find the cpu time taken by an executable to run.. the executable is writting the output to a file. i want to write the time takem by cpu to the same output file.

like:

abc is my executable which is taking input as input file and writing the result in output file.. i want to append cpu time information in the same file. can i do it with time command?

View 5 Replies View Related

Programming :: Cannot Run C++ Executable File From Ubuntu GUI?

Apr 17, 2011

I have written C++ programs on Windows. I am now learning Linux to ensure my software is portable. I can compile and run C++ programs from the bash shell, but I cannot run my executable programs from the GUI.Here is my sample program:

Code: #include <iostream>
int main()
{

[code]...

View 3 Replies View Related

Programming :: Call C Executable Inside C

Jan 8, 2010

i have only basic knowledge of C so guys plz help me...is C language support call the C executable inside the C ?example contect mainA.c have a many function define in the struct,when i compile mainA and make a executable the name is ( A ),can i use executable C inside the C <my C program call the executable ( A ) > .

View 9 Replies View Related

Programming :: Run Multiple Instances Of A Jar Executable?

May 5, 2009

It is possible to run multiple instances of a jar executable. Is it possible that only a single instance of the jar runs? Wrappers like JSmooth or Launch4J can be made to run as a single instance. But since there are no such wrappers for linux, I need a way to restrict the jar to a single instance. How to embed the jar file into an executable such it runs a single instance?

View 14 Replies View Related

Programming :: Call The Executable File From The GUI?

Jun 1, 2010

I have created a executable file using c and I have also created a GUI using GTK+. Now how can I call the executable file from the GUI with arguments passing to the executable file.

View 4 Replies View Related

Programming :: Add Version Information To An Executable?

Mar 2, 2010

when compiling a c++ program in g++ on Linux, how can I add version information to that executable and if possible is there a Linux utility to read the version information?

View 2 Replies View Related

General :: Fatal: Bad Magic Number In Executable `prime' (not An Executable?)

Sep 3, 2010

I am trying to run Wattch simulator in linux.But it is giving the error below. what is this error and what do I do about it?

fatal: bad magic number in executable `prime' (not an executable?)

View 1 Replies View Related

Programming :: Calling Gcc From Executable File / (makefile)

Oct 4, 2010

I am trying to use a software package written in ANSI C. It has a makefile which has to be executed first.

As soon as I execute it I get messages like: line i: command not found.

Commands for which I am getting errors :

CC = /usr/bin/gcc
GCCFLAGS = -c -Wall
ROOTDIR = .

My gcc compiler is located in the above directory only. In ROOTDIR also I tried giving the path in which all the required files & folders are present but still I get the command not found error in all the lines.

View 7 Replies View Related

Programming :: Hide C++ Codes In An Executable File?

Apr 4, 2011

I wrote a c++ program but for security reasons I need to make sure that no one can read my codes by my ".out" files. I did everything I could. But everyone can see it by "strings Alpha.cpp".I heard that g++ has some options to do so.

View 7 Replies View Related

Programming :: How To Use Bashrc To Redirect Executable Call?

May 24, 2011

I need to redirect a /usr/sbin/sendmail command to $HOME/bin/msmtp .The sendmail command would be coming from a PHP5 application. I'm assuming the best way is to use .bashrc, but .htaccess is also available.The remote server is a shared web host which is running Debian 4.0.I do not have root access.I have SSH access.

View 2 Replies View Related

Programming :: Random Libraries Are Not Directly Executable?

Jun 30, 2011

Since I read that executing a library could return its version number, I ran "/lib/libc.so.0" on uClinux, but it triggers an error.I'm told that random libraries are not directly executable. Does someone know what a random library is?PS: In case that matters, here's the short version of the error:

Code:
Undefined instruction
<5> - May be used to emulate instructions that are not defined for

[code]....

View 2 Replies View Related

Programming :: Removing Symbols From Binary Executable File

Aug 21, 2010

Arm-linux-strip for removing the symbols from binary executable file after compilation. What exactly the symbols means.

View 1 Replies View Related

Programming :: CVS Client That Comes As A Single Executable File Or Web Interface?

Oct 10, 2010

My senior project team at Penn State is starting to write our code, and I was looking for a revision control system to manage it. I was going to use CVS, but I can't find a client that doesn't have to install something on the local machine(we dont have administrative permissions on school computers). Is there a CVS(or Subversion or anything else) client that comes as a single executable file or web interface?

View 3 Replies View Related

Programming :: Store Executable Code In The Value Part Of A Hash?

May 28, 2010

I was reading about Ruby code blocks, but it's all a bit hazy.My questions:1. Can you store executable code in the value part of a hash (err...associative array)2. If you did, how would you call the code?3. If you executed this stored code, would it be possible when doing soto pass in an object to the code that it could use?

View 1 Replies View Related

Programming :: Query Of Commands That Made Executable With Chmod +x?

Aug 24, 2010

I have written a query of commands that I made executable with chmod +x, but this is an old version of what I'm writing. I'm in need of a way to determine the Operating System the user is using so that the script will run yum or apt-get on the right OS's.

View 11 Replies View Related

Programming :: Linking And Compiling Multiple C++ Files Into One Executable Program?

Dec 17, 2009

I have 3 c++ files, classdef.h (header file with class definition), methods.cpp (class methods) and program.cpp - the program itself. Both .cpp files have

Code:

#include "classdef.h"

in files. How I can link the files together and compile them in one executable program? I am using Geany IDE for coding.

View 4 Replies View Related

Fedora :: Make A Executable (application/x-executable)

Aug 21, 2011

I hope this post stands in the right section.I have a commandline i need to enter in terminal when i want to run a program. i tought lets put that piece of command in an .sh file and just click the file to run the program (then i dont need to open terminal first an give in the command) however the .sh file does not open the program. so i propably need to make a executable (application/x-executable).

View 3 Replies View Related

Ubuntu :: Cannot Open An Executable File Because Of Executable Bit?

Jun 20, 2010

I am running into a snag on .exe files in Lucid. I have Wine installed, but I can not open the file as it is blocked from executing with a window popping up telling me that this file was blocked due to security reasons. I go into the files properties and try to change the permission but that does not help. Is there a way to get around this? Possibly in the terminal as root?

View 3 Replies View Related

Programming :: Write A Script That Makes File Executable And Writes A Message That It Has Been Done?

Mar 10, 2010

like my alias a retired person, and Its never to late to learn something½ve just installed Ubuntu and found a tutorial online about bash-script.Manage some, but I cant to this one:[Write a script that makes file executable and writes a message that it has been done.If I run the command > <scriptName> <fileName> , then the file fileName should be executable and then it should indicate that fileName have been executable.]

Ive read man pages up-n-down and search the web, and I think I should let the script use chmod and ls -l, but I cant get the hole picture here. Actually I have nothing to show up, so I hope someone could help me with some ideas or a soloution - just to the how it should look.This is my first post, ever, at a forum like this, so please be nice if I didnt follow any rules here, I dont know if you even will answer this post, but at least give me some clues, a skeleton-code ti be based on

View 2 Replies View Related

Programming :: Linking Of Fortran Executable Taking Exorbitant Amounts Of Time?

Mar 24, 2010

The issue I am currently facing is more of an annoyance / curiosity, and it may not even be a problem, but it sure feels like one. Background: I am becoming a computational chemist (grad school begins in the fall) and the code I run is all in fortran. I am currently compiling with gfortran. When I compile the code (on a box running ubuntu server), everything appears to compile fine, but the linking stage is taking five to ten minutes. I ran the time command while making it and got the following results.

Quote:

time make
gfortran -c -O3 -fomit-frame-pointer -finline-functions -ffast-math suijtab.f
Linking testCompile ...
done

[code]...

I just don't understand why it is taking 5 minutes of real time if it only takes 10 - 15 sec of system time?

View 4 Replies View Related

Programming :: Re-mapping Stdio For A Fork'd/exec'd Executable Doesn't Seem To Behave

Jan 27, 2011

I have a monitoring program ( GIT link to sourceforge ) which I'm trying to use to track when a child exits/dies/whatever. I'm calling fork(), then close for 0,1,2, and then opening /dev/null, monitored.stdout, and monitored.stderr as a replacement. I'm not sure if I've done something incorrect (perhaps I should use dup2 for explicit assignment?) but it appears that printf() messages are just being blackholed. I've tried setting the line buffering as a last ditch effort. On a different system, using code similar to the spawn_monitor() function, this appears to work fine, which makes me think I'm relying on some implementation specific detail.

Relevant function, for those who don't click links:

Code:

26 int spawn_monitored(char *argv[])
27 {
28 int exit = 0;
29 pid_t child;
30 const struct rlimit inf = {

[code].....

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved