Results 1 to 2 of 2

Thread: Totally Mad Memory Leak

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Totally Mad Memory Leak

    Anyone seen anything like this before:


    Code:
    VARIANT myFunc(void);
    
    
    VARIANT vMyVarOK = myFunc();
    
    _variant_t vMyVarLeaks = myFunc();
    I have code where the second assignment leaks memory (you have to cycle it a lot of times, but the leak then beomes significant).

    There is no reason I can see why this should be a problem, but its causing a big leak (10+ MB) in my XML writing code...

    Dan

    Outside of a dog, a book is a man's best friend.
    Inside of a dog, it's too dark to read.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    OK, I'm at doofus...

    _variant_t constructors do ::VariantCopy's, no wonder it leaked!

    It should be done a la:

    Code:
    _variant_t vMyVarLeaks;
    vMyVarLeaks.Attach(myFunc());

    Dan

    Outside of a dog, a book is a man's best friend.
    Inside of a dog, it's too dark to read.

Posting Permissions

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



Click Here to Expand Forum to Full Width