Solved

SafeArray Destroy

Posted on 2002-04-29
5
715 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
Comment Utility

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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now