Solved

SafeArray Destroy

Posted on 2002-04-29
5
727 Views
Last Modified: 2012-05-04
Can I destroy a safearray which is created in another thread?
0
Comment
Question by:xutao
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

689 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