huge vector

Discussion in 'C++' started by Simon Adler, Oct 6, 2004.

  1. Simon Adler

    Simon Adler Guest

    Hello,

    I've got some Problems with a Programm.
    I use a Grid with Nodes. The Grid will be 64 * 64 Nodes huge.
    Each Node is a float. Some Algorithms ha've to copy the whole
    Grid, sometimes twice. If this happens, the code crashes. I've
    to choose a smaller Grid Spacing from 32 * 32 Grid Nodes, or less.

    Who can I use more Memory?
    I use vector, just because I read that indexed access is fast.
    An Ordinary float * is possible, but the Program crashes earlier.
    I've no Memory Leaks, I guess!

    Thanks for any Help!

    Simon


    --
    QOTD:
    Sacred cows make great hamburgers.
     
    Simon Adler, Oct 6, 2004
    #1
    1. Advertising

  2. Simon Adler

    Attila Feher Guest

    Simon Adler wrote:
    > Hello,
    >
    > I've got some Problems with a Programm.
    > I use a Grid with Nodes. The Grid will be 64 * 64 Nodes huge.
    > Each Node is a float. Some Algorithms ha've to copy the whole
    > Grid, sometimes twice. If this happens, the code crashes. I've
    > to choose a smaller Grid Spacing from 32 * 32 Grid Nodes, or less.
    >
    > Who can I use more Memory?
    > I use vector, just because I read that indexed access is fast.
    > An Ordinary float * is possible, but the Program crashes earlier.
    > I've no Memory Leaks, I guess!


    In short: Please post code!

    Medium: Talk is cheap, show me the code!

    Politically Correct: Please post the smallest compilable code experiencing
    the error.

    >Sacred cows make great hamburgers.


    I did not know they can cook.

    --
    Attila aka WW
     
    Attila Feher, Oct 6, 2004
    #2
    1. Advertising

  3. Simon Adler wrote:
    > Hello,
    >
    > I've got some Problems with a Programm.
    > I use a Grid with Nodes. The Grid will be 64 * 64 Nodes huge.
    > Each Node is a float. Some Algorithms ha've to copy the whole
    > Grid, sometimes twice. If this happens, the code crashes. I've
    > to choose a smaller Grid Spacing from 32 * 32 Grid Nodes, or less.
    >
    > Who can I use more Memory?
    > I use vector, just because I read that indexed access is fast.
    > An Ordinary float * is possible, but the Program crashes earlier.
    > I've no Memory Leaks, I guess!
    >
    > Thanks for any Help!


    How do you expect us to help you if you don't show any code that causes
    the crash? Please post the smallest, complete and compilable program
    that exhibits your problem.

    See also:
    http://www.slack.net/~shiva/welcome.txt


    BTW: 64 * 64 floats doesn't occupy that much memory so probably the
    problem has nothing to do with using too much memory.
    --
    Peter van Merkerk
    peter.van.merkerk(at)dse.nl
     
    Peter van Merkerk, Oct 6, 2004
    #3
  4. "Simon Adler" <-wedel.de> wrote in message
    news:-wedel.de...
    > Hello,
    >
    > I've got some Problems with a Programm.
    > I use a Grid with Nodes. The Grid will be 64 * 64 Nodes huge.
    > Each Node is a float. Some Algorithms ha've to copy the whole
    > Grid, sometimes twice. If this happens, the code crashes. I've
    > to choose a smaller Grid Spacing from 32 * 32 Grid Nodes, or less.
    >


    I think you have a bug in your program.

    > Who can I use more Memory?



    64*64*sizeof(float) is not a lot of memory, I don't think that is your
    problem.


    > I use vector, just because I read that indexed access is fast.
    > An Ordinary float * is possible, but the Program crashes earlier.


    Right, you have a bug somewhere, probably nothing to do with the size of the
    vector.

    > I've no Memory Leaks, I guess!
    >


    Guessing isn't good enough. But this doesn't sound like a memory leak, it
    sounds like a plain old bug.

    > Thanks for any Help!
    >


    Post some code, if it's not too much.

    john
     
    John Harrison, Oct 6, 2004
    #4
  5. > I've got some Problems with a Programm.
    > I use a Grid with Nodes. The Grid will be 64 * 64 Nodes huge.
    > Each Node is a float. Some Algorithms ha've to copy the whole
    > Grid, sometimes twice. If this happens, the code crashes. I've
    > to choose a smaller Grid Spacing from 32 * 32 Grid Nodes, or less.
    >
    > Who can I use more Memory?
    > I use vector, just because I read that indexed access is fast.
    > An Ordinary float * is possible, but the Program crashes earlier.
    > I've no Memory Leaks, I guess!


    64x64xfloat is not very much (32 KB). So there is clearly a bug in your
    code.
    You have to post some code to get specific help.
    Otherwise try to use a debugger and/or a boundschecker.

    Niels Dybdahl
     
    Niels Dybdahl, Oct 6, 2004
    #5
  6. Simon Adler

    JKop Guest

    Simon Adler posted:

    > Hello,
    >
    > I've got some Problems with a Programm.
    > I use a Grid with Nodes. The Grid will be 64 * 64 Nodes huge.
    > Each Node is a float. Some Algorithms ha've to copy the whole
    > Grid, sometimes twice. If this happens, the code crashes. I've
    > to choose a smaller Grid Spacing from 32 * 32 Grid Nodes, or less.
    >
    > Who can I use more Memory?
    > I use vector, just because I read that indexed access is fast.
    > An Ordinary float * is possible, but the Program crashes earlier.
    > I've no Memory Leaks, I guess!
    >
    > Thanks for any Help!
    >
    > Simon




    Line 15, you misspelled "vector".


    -JKop
     
    JKop, Oct 6, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pmatos
    Replies:
    6
    Views:
    24,134
  2. Replies:
    8
    Views:
    2,005
    Csaba
    Feb 18, 2006
  3. Javier
    Replies:
    2
    Views:
    627
    James Kanze
    Sep 4, 2007
  4. Replies:
    3
    Views:
    554
  5. Rushikesh Joshi
    Replies:
    0
    Views:
    399
    Rushikesh Joshi
    Jul 10, 2004
Loading...

Share This Page