#167 Node allocator behaves incorrectly in 64 bits


As discussed in this forum topic:

Currently on 64 windows platform, _S_heap_size is 32 bits. It will incorrectly try allocate a negative amount of memory when it reaches 2 gigs.


  • Francois Dumont

    Francois Dumont - 2008-02-20

    Logged In: YES
    Originator: NO

    Many modifications has been achieved in the trunk version of the node allocator:
    - correct management of the bad_alloc exception
    - use an atomic operation to access _S_heap_size

    However _S_heap_size is still not 32 bits for easier portability. To avoid the roll phenomena I have:
    - Change the way _S_heap_size is computed. Rather than doing '_S_heap_size >> 4' when using _S_heap_size I simply did the '>> 4' on the value added to _S_heap_size. This way _S_heap_size grows slower and reach 2 Go only when 16 Go has been allocated.
    - Add a cast in (unsigned long) before passing it to _S_round_up(size_t), this way even if _S_heap_size becomes negative, once cast it still gives a correct value.

    So even with _S_heap_size being a 32 bits value, application will have to allocate up to 32 Go before _S_heap_size goes back to 0. It sounds enough no ?

  • Francois Dumont

    Francois Dumont - 2008-02-20
    • assigned_to: nobody --> dums
    • status: open --> pending-fixed
  • SourceForge Robot

    Logged In: YES
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

  • SourceForge Robot

    • status: pending-fixed --> closed-fixed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks