Solved

SafeArray Destroy

Posted on 2002-04-29
5
718 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IE call stack entries where function call address is not in a module 4 67
Dynamically allocate memory 9 58
Safe conversion? 4 67
max float value 3 39
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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

816 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

10 Experts available now in Live!

Get 1:1 Help Now