<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: COBOL, C and C++  Memory Allocation Failure in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407067#M42159</link>
    <description>The C program has worked successfully for decades (literally) and the problem started occurring after linking with the C++ object. &lt;BR /&gt;&lt;BR /&gt;There is less than 1k of data being passed.&lt;BR /&gt;&lt;BR /&gt;Of course I have been in the debugger for hours with this problem and have found replacing STR$COPY_DX with my own manual building and loading of the string descriptor is working but would like to understand why this is necessary because I am concerned this may be pointing to other issues not yet encountered.&lt;BR /&gt;&lt;BR /&gt;Even though member alignment is turned off in C (it is turned off by default in COBOL), an EXAMINE/ASCID shows the correct string in C in the debugger but there is sometimes extra garbage at the end of the string when exmined in COBOL.  The string is passed BY DESCRIPTOR in COBOL.&lt;BR /&gt;</description>
    <pubDate>Sat, 25 Apr 2009 12:34:30 GMT</pubDate>
    <dc:creator>Wayne Byrd</dc:creator>
    <dc:date>2009-04-25T12:34:30Z</dc:date>
    <item>
      <title>COBOL, C and C++  Memory Allocation Failure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407065#M42157</link>
      <description>Memory allocation failure in C program on Alpha architecture.&lt;BR /&gt;&lt;BR /&gt;Using COBOL program as main program, a C program and a C++ program are called (which also calls the C program). Development of calling interface is nearly completed with successful use of WEBSphere MQ. The C++ program makes heavy use of Apache DOM for creating XML.&lt;BR /&gt;&lt;BR /&gt;STR$COPY_DX fails with access violation or produces unpredictable results other times when called from C program. Not using any special options with the CXXLINK command but suspect answer may be in this area.&lt;BR /&gt;&lt;BR /&gt;Help! To borrow from the old Notes ID, I'm driving a 57 accvio.</description>
      <pubDate>Fri, 24 Apr 2009 00:00:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407065#M42157</guid>
      <dc:creator>Wayne Byrd</dc:creator>
      <dc:date>2009-04-24T00:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: COBOL, C and C++  Memory Allocation Failure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407066#M42158</link>
      <description>The usual trigger for a failure with STR$COPY_DX or other services is a coding error or a preceding heap corruption, though it's certainly feasible to blow out P0 process address space or process PGFLQUOTA if you're loading large enough wads of data.&lt;BR /&gt;&lt;BR /&gt;Verify the validity of the descriptors being passed to the call using the debugger.&lt;BR /&gt;&lt;BR /&gt;And verify that there have been no modifications to any dynamic descriptors.&lt;BR /&gt;&lt;BR /&gt;Do some debugging, and try to reproduce the error in the debugger.  And see what's going on with the arguments.&lt;BR /&gt;</description>
      <pubDate>Fri, 24 Apr 2009 00:51:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407066#M42158</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-04-24T00:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: COBOL, C and C++  Memory Allocation Failure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407067#M42159</link>
      <description>The C program has worked successfully for decades (literally) and the problem started occurring after linking with the C++ object. &lt;BR /&gt;&lt;BR /&gt;There is less than 1k of data being passed.&lt;BR /&gt;&lt;BR /&gt;Of course I have been in the debugger for hours with this problem and have found replacing STR$COPY_DX with my own manual building and loading of the string descriptor is working but would like to understand why this is necessary because I am concerned this may be pointing to other issues not yet encountered.&lt;BR /&gt;&lt;BR /&gt;Even though member alignment is turned off in C (it is turned off by default in COBOL), an EXAMINE/ASCID shows the correct string in C in the debugger but there is sometimes extra garbage at the end of the string when exmined in COBOL.  The string is passed BY DESCRIPTOR in COBOL.&lt;BR /&gt;</description>
      <pubDate>Sat, 25 Apr 2009 12:34:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407067#M42159</guid>
      <dc:creator>Wayne Byrd</dc:creator>
      <dc:date>2009-04-25T12:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: COBOL, C and C++  Memory Allocation Failure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407068#M42160</link>
      <description>You're going to get to resolve this locally, or post the source code or a reproducer (and hope somebody has the time to debug it for you), or call in somebody to debug the code and the behavior for you.  Addressing these cases without access to the source code is difficult at best.  &lt;BR /&gt;&lt;BR /&gt;(You've described a whole lot of "moving parts" in this source code, too; some rather significant and complex pieces and parts. And some significant recent changes. More than enough to make even guessing difficult.  And these errors can be obscure.  That you have a specific call failing reliably is certainly very useful, though.)&lt;BR /&gt;&lt;BR /&gt;There's clearly some sort of a heap or stack error here, or a descriptor mismatch.  The descriptor you have referenced clearly has issues between the C and the COBOL environments.&lt;BR /&gt;&lt;BR /&gt;FWIW: if you're working with a dynamic descriptor that's been allocated storage, the contents of that dynamic descriptor should not typically be written directly by application code; write access should only be via the RTL calls.&lt;BR /&gt;&lt;BR /&gt;As for a path forward, look at the contents of the descriptor data structure that arrives, and at the Calling Standard manual, and at the COBOL requirements.  Mixed language programming usually involves looking at these documents and at example code (eg: COBOL to COBOL) to see what a calling or called routine expects or uses.&lt;BR /&gt;&lt;BR /&gt;That the code has worked for years without errors is certainly interesting, but that does not preclude the existence of latent errors.    I'm aware of bugs two and three times the age of this code, and in commonly-used code.  A 30+ year old bug surfaced in yacc, for instance.&lt;BR /&gt;&lt;BR /&gt;For some C debugging information, start here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://labs.hoffmanlabs.com/node/401" target="_blank"&gt;http://labs.hoffmanlabs.com/node/401&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here's what an ACCVIO really means:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://labs.hoffmanlabs.com/node/800" target="_blank"&gt;http://labs.hoffmanlabs.com/node/800&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And an intro to OpenVMS features and mechanisms in C programs:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://labs.hoffmanlabs.com/node/273" target="_blank"&gt;http://labs.hoffmanlabs.com/node/273&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 25 Apr 2009 13:13:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407068#M42160</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-04-25T13:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: COBOL, C and C++  Memory Allocation Failure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407069#M42161</link>
      <description>Wayne,&lt;BR /&gt;&lt;BR /&gt;Much more information is needed to determine&lt;BR /&gt;the cause. As a start, post the register&lt;BR /&gt;dump from the ACCVIO and the MAP file&lt;BR /&gt;for the image.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Guy Peleg&lt;BR /&gt;Maklee Engineering&lt;BR /&gt;&lt;A href="http://www.maklee.com" target="_blank"&gt;http://www.maklee.com&lt;/A&gt;</description>
      <pubDate>Sat, 25 Apr 2009 18:19:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407069#M42161</guid>
      <dc:creator>Guy Peleg</dc:creator>
      <dc:date>2009-04-25T18:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: COBOL, C and C++  Memory Allocation Failure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407070#M42162</link>
      <description>Wayne,&lt;BR /&gt;&lt;BR /&gt;if the program terminates with an ACCVIO, consider to enable a process dump:&lt;BR /&gt;&lt;BR /&gt;$ SET PROC/DUMP&lt;BR /&gt;$ RUN image...&lt;BR /&gt;&lt;BR /&gt;This will - in the case of of an image exit due to an imprperly handled condition - save all of the process virtual address space in a process dumpefile (imagename.DMP) and allow you to later use ANAL/PROC to examine the static situation at the time of the ACCVIO.&lt;BR /&gt;&lt;BR /&gt;Volker.</description>
      <pubDate>Sun, 26 Apr 2009 05:12:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407070#M42162</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2009-04-26T05:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: COBOL, C and C++  Memory Allocation Failure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407071#M42163</link>
      <description>I was using the dynamic instead of the static class when building the string descriptor in C++.&lt;BR /&gt;&lt;BR /&gt;Thanks for the advice.</description>
      <pubDate>Tue, 28 Apr 2009 01:04:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/cobol-c-and-c-memory-allocation-failure/m-p/4407071#M42163</guid>
      <dc:creator>Wayne Byrd</dc:creator>
      <dc:date>2009-04-28T01:04:05Z</dc:date>
    </item>
  </channel>
</rss>

