Question: terminate called after throwing an instance of 'std::bad_alloc?
0
gravatar for star
5 months ago by
star190
Netherlands
star190 wrote:

I have two files (A ~ 17 MB and B~ 8GB) that I like to intersect them using Bedtools but I faced with error, I want to know is there any solution for it? Also, I guess I have enough memory space.

intersectBed -a A.bed -b B.bed -wa -wb > out.bed

terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted (core dumped)

linux data bedtools • 1.0k views
ADD COMMENTlink written 5 months ago by star190
1

Also, I guess I have enough memory space.

well I guess you don't. Try -sorted and find out

ADD REPLYlink written 5 months ago by Carambakaracho1.8k

I did it and get terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc this time

ADD REPLYlink written 5 months ago by star190
2

I agree with Carambakaracho that the error is likely due to the fact that the process is filling up your RAM. Try and give a look at what happens with the RAM while you are executing the task. Another good try would be to repeat the task with a substantially reduced set of data (e.g. the first 2000 lines of B file) and see what happens. If it's just a RAM issue I think you might subset the second file in two/four chunks and do the work separately and then merge the files: I don't see downside in doing this.

ADD REPLYlink written 5 months ago by Fabio Marroni2.3k

Thanks for your reply, It is working when I am getting a subset of B file. So I will split that file to 2-3 files then run command.

ADD REPLYlink modified 5 months ago • written 5 months ago by star190
1

std::bad_alloc is the C++ error code for when a new operator tries to allocate something, but fails. As C++ cannot dynamically allocate memory, the lack of memory is the most common cause.

As of now, you didn't disclose anything on the machine you're working on, so I guess the most common cause, too. If your working on a HPC and allocated 1TB RAM, something else went wrong. For a start, Fabio Marroni gave good troubleshooting advice.

ADD REPLYlink modified 5 months ago • written 5 months ago by Carambakaracho1.8k

In my case, I was doing something different but got the same error (std::bad_alloc), and the memory was the problem - thanks!

ADD REPLYlink written 7 weeks ago by rodd50
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1718 users visited in the last hour