<p>A <code>std::bad_alloc</code> error tends to mean that you've run out of memory. It's not unusual for head nodes to be fairly limited in capacity, so presumably that's the issue.</p>

CC BY-SA 3.0
2018-02-27T12:41:15.767Z
2018-02-27T12:41:15.767Z
Devon Ryan
<p>I am running the following command to index my genome:</p>

<p><code>STAR --runThreadN 8 --runMode genomeGenerate --genomeDir output/index/star --genomeFastaFiles ref.fa --sjdbGTFfile ref.gff3 --sjdbGTFtagExonParentTranscript Parent --sjdbOverhang 100</code></p>

<p>and I get the following output:</p>

<pre><code>Feb 27 10:27:37 ..... started STAR run
Feb 27 10:27:37 ... starting to generate Genome files
Feb 27 10:27:40 ... starting to sort Suffix Array. This may take a long time...
Feb 27 10:27:42 ... sorting Suffix Array chunks and saving them to disk...
Feb 27 10:28:26 ... loading chunks from disk, packing SA...
Feb 27 10:28:30 ... finished generating suffix array
Feb 27 10:28:30 ... generating Suffix Array index
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
</code></pre>

<p>Searches for the GNU/Linux error lead to some pages about C++ that I don't understand. </p>

<p>Submitting it as a batch job works fine but I would like to know why it does not work on a node. It is quite practical for me to test small code like this without submitting a batch job.</p>

<p>The command above works fine on my laptop running Mac OSX.</p>

<p>The STAR version is STAR_2.5.3a on both computers: STAR_2.5.3a</p>

<p>The memory usage of the node is the following:</p>

<pre><code>total            used       free     shared    buffers       cached

251              251         0         0       0             232
</code></pre>

<p>so, is there 0 memory for me to use on this node?</p>

<p>Why is my indexing aborting? </p>

CC BY-SA 3.0
2018-02-27T12:28:34.663Z
Are they the same version of STAR? Compiled with the same flags? Do you have enough RAM on the node you are using?
terdon
CC BY-SA 3.0
2018-02-27T12:58:36.003Z
What do you mean by 'compiled with the same flags'? I have installed STAR using conda from the bioconda channel. Do you know how I can check the available RAM on my node?
Biomagician
CC BY-SA 3.0
2018-02-27T13:05:11.420Z
That will depend on how your system is set up, but if you have ssh access to your node, you can just run `free -h` (or just `free`) to see available memory. That said, you usually don't want to be running things directly from the nodes. Most such systems will have a queuing tool that will distribute jobs across nodes and that will help you avoid this type of problem, and ignoring the queue means i) you may well have the kind of problem you are encountering and ii) you are being rude to the other users of the system; you are effectively cutting the queue.
terdon
<phylogenetics><rna-alignment><linux><star><genome-index>
Why is my STAR reference genome indexing aborting on my GNU/Linux server but not on my Mac OS X laptop?
# Why is my STAR reference genome indexing aborting on my GNU/Linux server but not on my Mac OS X laptop?

(Asked by: username_0 on 2018-02-27)

I am running the following command to index my genome:
STAR --runThreadN 8 --runMode genomeGenerate --genomeDir output/index/star --genomeFastaFiles ref.fa --sjdbGTFfile ref.gff3 --sjdbGTFtagExonParentTranscript Parent --sjdbOverhang 100
and I get the following output:
Feb 27 10:27:37 ..... started STAR run
Feb 27 10:27:37 ... starting to generate Genome files
Feb 27 10:27:40 ... starting to sort Suffix Array. This may take a long time...
Feb 27 10:27:42 ... sorting Suffix Array chunks and saving them to disk...
Feb 27 10:28:26 ... loading chunks from disk, packing SA...
Feb 27 10:28:30 ... finished generating suffix array
Feb 27 10:28:30 ... generating Suffix Array index
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Searches for the GNU/Linux error lead to some pages about C++ that I don't understand. 
Submitting it as a batch job works fine but I would like to know why it does not work on a node. It is quite practical for me to test small code like this without submitting a batch job.
The command above works fine on my laptop running Mac OSX.
The STAR version is STAR_2.5.3a on both computers: STAR_2.5.3a
The memory usage of the node is the following:
total            used       free     shared    buffers       cached

251              251         0         0       0             232

so, is there 0 memory for me to use on this node?
Why is my indexing aborting?

**Tags:** phylogenetics, rna-alignment, linux, star, genome-index
> **Comments:**
> **username_1**: Are they the same version of STAR? Compiled with the same flags? Do you have enough RAM on the node you are using?  
> **username_0**: What do you mean by 'compiled with the same flags'? I have installed STAR using conda from the bioconda channel. Do you know how I can check the available RAM on my node?  
> **username_1**: That will depend on how your system is set up, but if you have ssh access to your node, you can just run `free -h` (or just `free`) to see available memory. That said, you usually don't want to be running things directly from the nodes. Most such systems will have a queuing tool that will distribute jobs across nodes and that will help you avoid this type of problem, and ignoring the queue means i) you may well have the kind of problem you are encountering and ii) you are being rude to the other users of the system; you are effectively cutting the queue.  

---

## 1 answers

### Answer by username_2 on 2018-02-27. Score: 1 | Accepted answer

A `std::bad_alloc` error tends to mean that you've run out of memory. It's not unusual for head nodes to be fairly limited in capacity, so presumably that's the issue.


---

