public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* std::list.sort() blocks on very large lists (>12GB) GCC 4.0.1 Mac  OS X 64-bit
@ 2009-07-16 23:13 jpitt
  2009-07-17  1:00 ` Ian Lance Taylor
  2009-07-18  9:49 ` Nicholas Sherlock
  0 siblings, 2 replies; 3+ messages in thread
From: jpitt @ 2009-07-16 23:13 UTC (permalink / raw)
  To: gcc-help

Hi-

I'm experiencing a weird problem that makes me wonder if there is a  
problem with the std::list.sort member function when used on very  
large lists. I have a very large list (~20GB) that is made up of a  
class (382bytes each) of DNA sequence data. When the list is on the  
order of 12GB it sorts fine, but if it gets up into the 17GB range  
when I call sort() it seems to block. The list has already been built  
so I don't think it's a malloc issue. I also don't think it's a  
complexity problem because the 12GB list sorts fine (it takes a minute  
or so), so I'm wondering if the std sort method doesn't properly  
handle the excess memory available in 64bit mode? Has anyone  
experienced this?

-thanks
jason

=====================================================================
Jason Pitt PhD                                        jpitt@fhcrc.org
Ferre-D'Amare Lab                                        206.667.3603
Howard Hughes Medical Institute
University of Washington
Fred Hutchinson Cancer Research Center
1100 Fairview Ave N A3-015 Seattle WA 98109
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: std::list.sort() blocks on very large lists (>12GB) GCC 4.0.1 Mac  OS X 64-bit
  2009-07-16 23:13 std::list.sort() blocks on very large lists (>12GB) GCC 4.0.1 Mac OS X 64-bit jpitt
@ 2009-07-17  1:00 ` Ian Lance Taylor
  2009-07-18  9:49 ` Nicholas Sherlock
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2009-07-17  1:00 UTC (permalink / raw)
  To: jpitt; +Cc: gcc-help

jpitt@fhcrc.org writes:

> I'm experiencing a weird problem that makes me wonder if there is a
> problem with the std::list.sort member function when used on very
> large lists. I have a very large list (~20GB) that is made up of a
> class (382bytes each) of DNA sequence data. When the list is on the
> order of 12GB it sorts fine, but if it gets up into the 17GB range
> when I call sort() it seems to block. The list has already been built
> so I don't think it's a malloc issue. I also don't think it's a
> complexity problem because the 12GB list sorts fine (it takes a minute
> or so), so I'm wondering if the std sort method doesn't properly
> handle the excess memory available in 64bit mode? Has anyone
> experienced this?

Without more information, my first guess would be that you are exceeding
the available working set on your machine, and thrashing.
std::list.sort is written to assume that the entire list can be stored
in the working set.  Sorting an amount of data that is significantly
larger than available RAM generally requires different techniques for
efficiency.  For example, manually splice() the list into lists which
are small enough to sort efficiently, and then merge() the results
together.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: std::list.sort() blocks on very large lists (>12GB) GCC 4.0.1  Mac  OS X 64-bit
  2009-07-16 23:13 std::list.sort() blocks on very large lists (>12GB) GCC 4.0.1 Mac OS X 64-bit jpitt
  2009-07-17  1:00 ` Ian Lance Taylor
@ 2009-07-18  9:49 ` Nicholas Sherlock
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Sherlock @ 2009-07-18  9:49 UTC (permalink / raw)
  To: gcc-help

jpitt@fhcrc.org wrote:
> I'm experiencing a weird problem that makes me wonder if there is a 
> problem with the std::list.sort member function when used on very large 
> lists. I have a very large list (~20GB) that is made up of a class 
> (382bytes each) of DNA sequence data. When the list is on the order of 
> 12GB it sorts fine, but if it gets up into the 17GB range when I call 
> sort() it seems to block. The list has already been built so I don't 
> think it's a malloc issue. I also don't think it's a complexity problem 
> because the 12GB list sorts fine (it takes a minute or so), so I'm 
> wondering if the std sort method doesn't properly handle the excess 
> memory available in 64bit mode? Has anyone experienced this?

Double check the comparison function you're using. If it doesn't 
properly conform to the specification, sort() can get into an infinite 
loop. Here's some info on the matter:

http://blogs.msdn.com/oldnewthing/archive/2009/05/08/9595334.aspx
http://blogs.msdn.com/oldnewthing/archive/2003/10/23/55408.aspx

Cheers,
Nicholas Sherlock

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-18  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-16 23:13 std::list.sort() blocks on very large lists (>12GB) GCC 4.0.1 Mac OS X 64-bit jpitt
2009-07-17  1:00 ` Ian Lance Taylor
2009-07-18  9:49 ` Nicholas Sherlock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).