Copy link to clipboard
Copied
Hello.
I have a file with a lot of elements on page. I use CosObjEnum with my own procedure to enumerate it. But after some iterations (over 10000) acrobat closes after function CosNameValue. In the same time it does not throw any exceptions, just closes. Can anybody tell me what it was?
Thank you.
Copy link to clipboard
Copied
When you run Acrobat in the debugger, do you get any indication why it "closes"? This closing may actually be a crash. Are you sure you are releasing all resources you are acquiring? Do you have an exception handler in place around the location where you assume the problem occurs?
Copy link to clipboard
Copied
I don't get any indication, acrobat just closes like it is normal exit. Yes, I have exception handler but it was ignored.
When I remove line "CosNameValue(obj);", everything is OK.
Copy link to clipboard
Copied
Did you check if the object was valid and of type CosName before you called CosNameValue() on it?
However, even so, it would be throwing an exception. You are using DURING/HANDLER blocks and not trying C/C++ exceptions, right?
Copy link to clipboard
Copied
Yes, I check type of object: if (CosObjGetType(obj) == CosName). Is it enough?
And yes: I use DURING/HANDLER blocks.
Copy link to clipboard
Copied
Things to think about. * Is Acrobat stopping or crashing? Very different things. * If you run under the debugger does it stop for an exception? What is in the call stack * Is Acrobat running out of virtual memory? How much is in use at the time of failure? * You say 10,000 iterations+ Is that 10,000 calls to your procedure (which is hardly anything) or 10,000 documents/runs (which is probably too many). * Are you creating new names (ASAtoms in a loop)? There is a low limit.
Copy link to clipboard
Copied
Acrobat is just stoping without any messages. If I run under the debugger it doesn't stop for an exception.
At the time of failure Acrobat uses near 100M memory.
As I wrote I use CosObjEnum and it calls my function 10000+ times. And no, at this moment i do not create any names, i just call CosNameValue.
Copy link to clipboard
Copied
Stopping without messages or a break in the debugger is bad. I have seen this but cannot recall the cause. It may not be a simple API call failure, but we'll have to start on that assumption.
100MB is nothing, no problem there.
Let's look at the ~10,000 calls
* Does this happen on random files, or particular files, or just one file?
* If it's a particular file maybe the problem is a specific object. Suggest you add a counter to try and find the actual count (perhaps write to a file, but remember to fflush).
* If the count is always the same, on a single PDF, suggests the next object has a problem. You could try adding a test to skip the CosName Value on that particular callback. Not a general solution but if it works it confirms a problem file
* Perhaps try running some preflight function which is likely to use the same APIs, see if it fails
Copy link to clipboard
Copied
I get this situation only with 1 file but I have not too many files with a lot of objects.
Counts are always different.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now