Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: "HeapAlloc/HeapReAlloc" or "malloc/new/alloc"

  1. #1
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Germany, Hannover
    Posts
    224

    "HeapAlloc/HeapReAlloc" or "malloc/new/alloc"

    which functions in "subject" should i use, when my data is quite often resized, is there a performance benifit for some of these functions ? (no AGP mem usage !)

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Aug 2000
    Location
    Portsmouth, Hampshire, England
    Posts
    1,063

    Re: "HeapAlloc/HeapReAlloc" or "malloc/new/alloc"

    er.. haven't had 1st hand experience with all them functions, but they probably all do the same thing.

    I would say redesign your algorithm and/or data, so you dont need to resize arrays often, or preferably not at all.

    Nutty

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,797

    Re: "HeapAlloc/HeapReAlloc" or "malloc/new/alloc"

    If you are resizing your array constantly, you might want to consider using a linked list instead. This might not work well if you are using the array for something like OpenGL vertex arrays, though. Another thing you could use is the STL vector container.
    Deiussum
    Software Engineer and OpenGL enthusiast

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2001
    Posts
    4

    Re: "HeapAlloc/HeapReAlloc" or "malloc/new/alloc"

    I find that STL is the best way of doing this but there is a noticeable performance hit.
    I only use STL for initialization purposes (i.e. an array which contains what displaymodes are available, etc)
    BTW in c++, realloc and malloc shouldn't be used.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •