I've been trying to work out why my fork is segfaulting on a string copy 
(which suggests a memory overwrite error somewhere else), and found an 
odd thing in the sequence loader (this is from sebhtml/ray:

void SequencesLoader::registerSequence(){
  ...
  Read myRead;
  myRead.constructor(read,&(*m_persistentAllocator),true);
  m_myReads->push_back(&myRead);
  ...
}

note that the function returns void, but the address of a variable 
declared in the function is stored in an array, with the expectation 
that this address will be accessible later. I suspect that the memory 
allocated for myRead will be flagged as available once the function 
exits, causing problems (i.e. overwritten memory) later. I expect a fix 
for this would go something like this:

void SequencesLoader::registerSequence(){
  ...
  Read* myRead = new Read();
  myRead.constructor(*read,&(*m_persistentAllocator),true);
  m_myReads->push_back(myRead);
  ...
}

Note that the code will need to deallocate that memory later, once the 
array of reads gets deleted.

There's also another (?related) issue in that Read doesn't have a 
destructor, but it stores a uint8_t array which may need to be 
deallocated (or somehow flagged for potential deallocation) once the 
read structure is removed.

Unfortunately, changing the 'Read myRead' to a 'Read* myRead = new 
Read()' doesn't fix my particular segfault problem, so I need to hunt 
elsewhere. I assume that the problem is in code I've modified, because 
I've done successful phiX assemblies with the current sebhtml/ray.

-- David

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Denovoassembler-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/denovoassembler-users

Reply via email to