Skip to main content

[Migrated content. Thread originally posted on 27 September 2011]

We have made a COM wrapper around an existing COBOL program using the Interface Mapping Toolkit. In the existing COBOL program we have used several entrypoints with parameters that are defined in the linkage section. Registering and using it by making an instance of that object in VB6 is possible. Even intellisense works fine. Much of it does work, but when we we call one function a 100000 times (for that function has 100000 records) we get an Out of memory error followed by a MFCLBINP Error 601. We have tried the several COM options in the deploy option: Apartment, Both, Free and Neutral.
Does someone have any idea what possibly might causes this problem?
Here is an extraction of the cobol program that we use:

Linkage section.
01 asPar0 pic x(4096).
01 filler redefines asPar0.
03 asPar0-data pic x(4095).
03 asPar0-ind pic 9(01).

01 asPar1 pic x(4096).
01 filler redefines asPar1.
03 asPar1-data pic x(4095).
03 asPar1-ind pic 9(01).


Entry “COB_ADDNEW” dynamicNTStdCallPlus2 using by reference asPar0.
copy ‘addnew’.
exit program return Returncode.

Entry “COB_FIELDDEFS” dynamicNTStdCallPlus2 using by reference asPar0
by reference asPar1.
copy ‘fielddefs’.
exit program return Returncode

and so on.

[Migrated content. Thread originally posted on 27 September 2011]

We have made a COM wrapper around an existing COBOL program using the Interface Mapping Toolkit. In the existing COBOL program we have used several entrypoints with parameters that are defined in the linkage section. Registering and using it by making an instance of that object in VB6 is possible. Even intellisense works fine. Much of it does work, but when we we call one function a 100000 times (for that function has 100000 records) we get an Out of memory error followed by a MFCLBINP Error 601. We have tried the several COM options in the deploy option: Apartment, Both, Free and Neutral.
Does someone have any idea what possibly might causes this problem?
Here is an extraction of the cobol program that we use:

Linkage section.
01 asPar0 pic x(4096).
01 filler redefines asPar0.
03 asPar0-data pic x(4095).
03 asPar0-ind pic 9(01).

01 asPar1 pic x(4096).
01 filler redefines asPar1.
03 asPar1-data pic x(4095).
03 asPar1-ind pic 9(01).


Entry “COB_ADDNEW” dynamicNTStdCallPlus2 using by reference asPar0.
copy ‘addnew’.
exit program return Returncode.

Entry “COB_FIELDDEFS” dynamicNTStdCallPlus2 using by reference asPar0
by reference asPar1.
copy ‘fielddefs’.
exit program return Returncode

and so on.
What is the call-convention dynamicNTStdCallPlus2 defined as in special-names?
Can you try this without the call-convention name on the entry point?

How is your actual program packaged, .int, gnt or .dll?

If it is being linked as .dll then make sure that it is linked to the multi-threaded runtime system.
The COM wrapper itself should be built as apartment threaded.

Is it the call itself that is causing the memory leak or something that your program is doing?
You might want to code an exit program at various places in the program to try to determine the location of the memory leak.

Start by placing the exit program at the beginning of the procedure division and then call the entry point 100000 times. Does it still get the out of memory error?