Re: Occurs Depending Memory Use




Kevin Solomon wrote:
> Hi Everyone:

> If I define a second table with an OCCURS DEPENDING ON clause I had
be
> taught (and never before questioned) that memory allocation was
dynamic.

The overhead of reallocating the memory every time the 'depending on'
changed would be a complete waste. Typically a table may be built by
adding one item at a time and incrementing the depending on before
loading the data. This would mean that each increment would create a
new block of memory and then copy over the data to the new area and
release the old. Or how did you think dynamic memory worked ?

> The memory used would be only that which corresponds to the size of
one
> occurrence times the value of the depending on variable.

And what would be the point ? of actually reducing the memory, would
this allow some other program to use it ? If it did the table could
not grow back in the same place.

It acts _as_if_ it is the size specified by the depending on, but does
not allow other programs or other data areas to use the memory up to
the maximum specified.

> If there's no real savings in memory, then what's the point?

It acts _as_if_ the depending on is the actual size. If you write a
record it writes that size, not the whole area. SEARCH and SORT use
that size. If you MOVE the record, again only that size (saving CPU
cycles). BOUND chacks _may_ be done based on the depending on and not
the maximum size.

I would ask: what would be the point in reallocating a new memory area
and copying every time the depending on changes ? - because you would
have to to change the total memory usage.

.



Relevant Pages

  • Re: Occurs Depending Memory Use
    ... OCCURS DEPENDING ON clause is in overall performance and not in the amount ... of memory allocated. ... >> If there's no real savings in memory, ...
    (comp.lang.cobol)
  • Re: Occurs Depending Memory Use
    ... IBM supports NON-Standard ODO's (Occurs Depending On) where they are either ... > question on memory allocation and memory use in employing an OCCURS ... > DEPENDING ON clause versus an OCCURS TIMES clause. ...
    (comp.lang.cobol)
  • Re: Occurs Depending Memory Use
    ... dynamic-capacity tables as well as elementary items whose size can be varied ... > The overhead of reallocating the memory every time the 'depending on' ... >> If there's no real savings in memory, ...
    (comp.lang.cobol)
  • Re: Occurs Depending Memory Use
    ... > If I understand what Richard's saying, the only real savings of using ... > an OCCURS DEPENDING ON clause is in overall performance and not in the ... > amount of memory that is actually necessary for each iteration. ...
    (comp.lang.cobol)
  • Re: [discuss] Re: 32-bit dma allocations on 64-bit platforms
    ... > Depending on the architecture (more precisely depending if it starts ... > allocating ram from the end or from the start of the physical memory), ... > through the swap device to relocate memory because memory would been allocated ...
    (Linux-Kernel)