|
I must be missing something in the cleanup, but here is a cut version of the code that causes the leak.
<br />
CExcelRange usedCells = oSheet.get_UsedRange();<br />
<br />
<br />
COleSafeArray cellArray(usedCells.get_Value());<br />
<br />
<br />
usedCells.Clear();<br />
usedCells.ReleaseDispatch();<br />
VariantClear(cellArray);<br />
cellArray.Clear();<br />
cellArray.Detach();<br />
I have deliberately cut down my code for testing so it essentially does nothing but load the file. There is no code between "COleSafeArray cellArray(usedCells.get_Value());" and "usedCells.Clear();" to help narrow down the leak.
If I comment out the line "COleSafeArray cellArray(usedCells.get_Value());" (and oviously the associated cleanup so it will compile) I have no leak, but if it calls this line I get an immediate loss of ~4-5 times the file size which equates to about 30 meg per file. If I run this multiple times it continues to drop, so I don't think it is a windows caching problem. Anybody know what I'm missing?
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
OK I've worked it out. It seems you cannot set the data via the constructor or it will cause a leak, don't ask me why, it just does. Otherwise it works fine. The fix is to replace the faulty line with these two
COleSafeArray cellArray;
cellArray.Attach(usedCells.get_Value());
I have also noticed with this fussing today that if a value is assigned to any form of variant based objects in C++ it will leak unless you call Clear() after every assignment. One of the many reasons why I despise variants.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
hi
1)I want to Verify Windows Firewall Settings in VC or VB(since API functions can be used in both).
2)Verify DCOM Privileges to run DCOM based applications
can anyone point to some links or atleast give an idea abt the kind of functions to look for?
thanx in advance
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
-- modified at 4:23 Thursday 4th May, 2006
|
|
|
|
|
I delete a class in the vc++ 6.0 by removing the .h and .cpp file from project and then deleting them from the disk folder .
But when I want to create a class with the same name as I deleted just now, an error message box pops up say something like "the class ... is in use, please specify another name...".
even restarting the visual c++ program does not make any help.
why dose this happen, and how to fix it?
Thank you very much!!!
-------------------
I am learning C++ and English
-- modified at 4:10 Thursday 4th May, 2006
|
|
|
|
|
Try deleting the .clw file and when you open classwizard again specify all files, should fix it.
Master.. Master.. where are the dreams that i've been after...
|
|
|
|
|
Hi,
I have newly created MFC 32 Application, can any one please tell how to add Help [F1] documents and images to project.
Regards,
Parichay.
|
|
|
|
|
Hi
Please use Accelerator in Resource
by
KK
|
|
|
|
|
Hi,
Thanks for the msg,
Can u please expand and tell what i have to do..
i am new to VC++.
|
|
|
|
|
hi,
Thank for the msg,
can u please expand and tell me what i have to do. i am new to VC++.
|
|
|
|
|
|
Hi,
Is there any way to get paths to special folders like "Program Files"
or "Common Files" but on remote machine ?
I need to get path to Program Files folder - I can use RegConnectRegistry and read out from there but it doesn't work i.e. on WinXP Home Ed.
-----------
Mila
|
|
|
|
|
Hi All,
Can anyone know how to find the audio level from the microphone? Basically I want to splitup the audio level from no audio(if the person is silent) to very high level... How can i get the frequency??
Thanks,
Poornima
|
|
|
|
|
|
Hello Poornima,
You could also try the FFTW subroutine library. The functions are easy to use and
competitive with vendor tuned code.
http://www.fftw.org/
|
|
|
|
|
Thanks a lot for the guidance.
|
|
|
|
|
What do you want - audio level (volume) or audio tone (frequency) or both?
FFT will give you frequency and a volume-related value at each frequency.
If you want only volume, you could calculate an average peak-to-peak value for some period as an estimate.
|
|
|
|
|
Hey,
I dont understand your question... Frequncy and volume are interelated rite... I mean frequency directly proportional to audio ???
do clear me If i am wrong.
|
|
|
|
|
Volume is how loud the sound is (a soft sound, like someone wispering, has low volume, a loud sound, like a fighter aircraft engine, has high volume.)
Frequency is the pitch or tone of a sound - a double bass plays notes which have a low frequency (a low cycle per second or Herz value) while a penny whistle plays notes which have a high frequency.
The frequency and the volume of a sound are not really related, although human perception does come into it.
The normal PC software volume control only controls volume, it does not affect frequency.
From your original question, I think you were trying to decide whether a sound was soft or loud, i.e. volume. My point was that you should be able to determine this in a simpler way than doing an FFT.
|
|
|
|
|
Let's say you have a block of audio data from the microphone (you could use the WaveIn functions - see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_waveform_functions.asp[^] .)
The data block has a number of characteristics which you specify, such as block length (50 or 100 milliseconds is reasonable), sampling rate (22 kHz should be OK), sample size (8 or 16 bit per sample), stereo or mono (microphone is probably mono.)
The general procedure I would follow would be:
Long SumOfSamples = 0
Long SumOfSquaredDifferences = 0
For count = 1 to numberSamplesInBlock
SumOfSamples += soundSample[count]
AverageSoundLevel = SumOfSamples / numberSamplesInBlock
For count = 1 to numberSamplesInBlock
ThisSampleDifference = sample[count] - AverageSoundLevel
SumOfSquaredDifferences += ThisSampleDifference * ThisSampleDifference
AverageDifference = SquareRoot(SumOfSquaredDifferences) / numberSamplesInBlock
If AverageDifference < softSoundThreshold
Display "The Sound Is Soft"
Else if AverageDifference > loudSoundThreshold
Display "The Sound Is Loud"
Else
Display "The Sound Is Between Soft And Loud Limits"
|
|
|
|
|
I need a virtual drive in ram , not in hard disk .
plz help me.
|
|
|
|
|
I saw like your question in another sites
and they want to create or lock virtual ram
can you be more specific.
|
|
|
|
|
I need a software , a example , a prescription ,the last word a way to create a virtual drive in ram , for example to create a file on it like other drives and adress it like "E:\" .
if you know anything like that please tell me .
tank you
|
|
|
|
|
This[^] is one tool that I found. I haven't used it though.
You can google with the term RamDisk to get some specific hits.
Nibu thomas
Software Developer
|
|
|
|
|
thanks a lot , it was useful to me .
|
|
|
|
|
V_shr wrote: thanks a lot , it was useful to me
So! What are you upto...:smugging:;P
Nibu thomas
Software Developer
|
|
|
|