Solved

SafeArray Destroy

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
returning a dereferenced pts in C++ 10 158
IdTCPClient1->Disconnect(); not working 3 76
What is sub-make ? 2 71
How do I get Window Title of all opened process? 4 11
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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

808 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