Solved

SafeArray Destroy

Posted on 2002-04-29
5
723 Views
Last Modified: 2012-05-04
Can I destroy a safearray which is created in another thread?
0
Comment
Question by:xutao
5 Comments
 
LVL 2

Expert Comment

by:vbk_bgm
ID: 6979838

Yes. Just use SafeArrayDestroy;
SAFEARRAY *psa;
//safearray created
SafeArrayDestroy(psa);

What does your SAFEARRAY contain as elements (BSTR , integer etc)? What problem are you facing when you are destroying the array?
0
 
LVL 1

Author Comment

by:xutao
ID: 6980197
The type of my safearray is VT_UI1, I use it to hold the data which is received from windows socket.
After I created the safearray, I post it's descriptor to another thread which is responsible for firing events to the COM client.
Then I destroy the safearray after the fire_XXXX call returns. I checked the return value, everything is OK, but I found the amount of memory usage is increasing.
I'm sure it is not locked when I destroy the safearray.
0
 
LVL 2

Accepted Solution

by:
vbk_bgm earned 50 total points
ID: 6980290
What funstion are you using to create the SafeArray.
SafeArrayCreate or SafeArrayAllocDescriptor. Since you are using are a variant type you need not use SafeArrayDestroyDescriptor.
Create using SafeArrayCreate, destroy using SafeArrayDestroy
0
 
LVL 11

Expert Comment

by:griessh
ID: 7122213
Dear xutao

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "vbk_bgm "

comment(s) as an answer.

If you think your question was not answered at all, you can explain here why you want to do this and post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/


PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7138124
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question