punkish has asked for the wisdom of the Perl Monks concerning the following question:
1. COM chews up a lot of memory and pegs the CPU. Not an issue for short processes, but for long processes, the memory heap keeps on building up, and then eventually quits... I get a funky "Smart Heap Library" error -- obviously not very "Smart," Of course, the computer also gets extremely sluggish (does Windows had a 'nice' equivalent for COM?). So, I am trying to FreeUnusedLibraries and Uninitialize (methods in Win32::OLE) and re-initialize, but am not sure if it is helping.
2. Seems like VB/COM has a latency that the OS doesn't seem to respect. Here is what happens --
a. do something with COM b. do something as a result of #1
One would expect that #b above would be carried out ONLY when #a above has cleanly ended. Well, apparently not. #a is started, the OS thinks it is done, and passes command to #b, but #a is still chugging along. These race conditions are unpredictable. I have been experimenting with
Win32::OLE->FreeUnusedLibraries(); Win32::OLE->SpinMessageLoop(); sleep 5;
but, as I said, these race conditions are unpredictable. Typically, I encounter this when I delete something in a directory 'dir' (#a above), and then do something (#b) that expects an empty directory 'dir', but #b comes back and says that the directory 'dir' is still not empty. I can change sleep 5 to sleep 10, but never any guarantee.
3. File/folder permissions. This is a strange one. I get an erro if I do the following --
a. mkdir(folder) b. put something in that folder c. do something with stuff put in #b above or confess
The error is akin to "stuff doesn't exist" even though it is clearly there, and file tests pass successfully. My process croaks and I restart. Since this time the folder already exists, I don't encounter the error. This happens consistently, and without any intervening changes to the permissions. I've got around this by pre-creating folders, but then I can't use any logic that depends on existence or absence of folders.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cpu, memory, and permissions issues with Win32::OLE
by starbolin (Hermit) on Aug 19, 2006 at 07:52 UTC | |
|
Re: cpu, memory, and permissions issues with Win32::OLE
by BrowserUk (Patriarch) on Aug 19, 2006 at 09:30 UTC | |
|
Re: cpu, memory, and permissions issues with Win32::OLE
by Anonymous Monk on Aug 22, 2006 at 12:57 UTC |