Turbo Vision and memory 
Author Message
 Turbo Vision and memory


Quote:
>Hi!
>I wrote my first Turbo Vision program and got a problem (I think so):
>To test my program I did something like:
>program test;
>begin
>   startbyte:=memavail;
>   test.Init;
>   test.Run;
>   test.Done;
>   endbyte:=memavail;
>if startbyte<>endbyte then
>begin
>   writeln('start:',startbyte);
>   write('end: ',endbyte);
>   readln;
>end;
>end.
>I think that, if I coded well, startbyte should never differ from endbyte.
>Am I right ?
>If so I got to seek the leak
>:-(

You might -- depends on how large the difference is.  The memory-available
function tries to be very, very fast, and so it is really an approximation of
the total number of bytes you can still squeeze out of the heap.  For example,
if you request a structure with an odd number of bytes or somesuch you might
get a little "slack," and there might be some amount of storage crumbed by
"fragmentation" similar to what happens on a hard disk.

/mr/



Wed, 18 Jun 1902 08:00:00 GMT  
 Turbo Vision and memory
Hi!
I wrote my first Turbo Vision program and got a problem (I think so):
To test my program I did something like:

program test;

begin
   startbyte:=memavail;
   test.Init;
   test.Run;
   test.Done;
   endbyte:=memavail;

if startbyte<>endbyte then
begin
   writeln('start:',startbyte);
   write('end: ',endbyte);
   readln;
end;
end.

I think that, if I coded well, startbyte should never differ from endbyte.
Am I right ?
If so I got to seek the leak
:-(

ciao joe



Wed, 18 Jun 1902 08:00:00 GMT  
 Turbo Vision and memory



Quote:
Radinger (WINVN)) writes:

|
||Hi!
||I wrote my first Turbo Vision program and got a problem (I think so):
||To test my program I did something like:
|
|program test;
|
|begin
||   startbyte:=memavail;
||   test.Init;
||   test.Run;
||   test.Done;
||   endbyte:=memavail;
|
||if startbyte<>endbyte then
||begin
||   writeln('start:',startbyte);
||   readln;
||end;
||end.
|
||I think that, if I coded well, startbyte should never differ from endbyte.
||Am I right ?
||If so I got to seek the leak
||:-(
|
|You might -- depends on how large the difference is.  The memory-available
|function tries to be very, very fast, and so it is really an approximation of
|the total number of bytes you can still squeeze out of the heap.  For
|xample,
|if you request a structure with an odd number of bytes or somesuch you might
|get a little "slack," and there might be some amount of storage crumbed by
|"fragmentation" similar to what happens on a hard disk.
|
|/mr/
|

Hi,

Sorry, but if there is a difference there's a memory leak. Every request for
memory is rounded of to blocks of 8 bytes, when the memory is released all the
blocks are returned to the heap and there should be no difference in the
available memory before and after the program. I use the same construct in my
Turbo Vision programs to detect memory leaks.

BTW the Turbo Vision newsgroup is comp.os.msdos.programmer.turbovision in
future post your TV question there.

        Alex



Wed, 18 Jun 1902 08:00:00 GMT  
 Turbo Vision and memory

Quote:
>Hi!
>I wrote my first Turbo Vision program and got a problem (I think so):
>To test my program I did something like:

Any time I do something that uses dynamic memory allocation - such as
writing a TurboVision app - I do the same kind of checking for memory leaks
as you posted.  Any time I have found a memory leak while using TurboVision
it has always turned out to be my fault, not TV's.  Since every thing I
write HAS to be able to run on 8086 and 80286 class clunkers, TV is the
interface kit I use, as opposed to developing windoze apps with Delphi or
some other tools.  Ie., I use TV a great deal.

Rob



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Memory problem using Turbo Vision

2. WTD - Borland/Turbo Pascal Manuals/SW Especially Turbo Vision

3. Index-file browser for turbo vision (Turbo Pascal ver 6.0)

4. musicv11.zip Music Vision memory game + TP source

5. Can I use Graphics Mode in Turbo Vision?

6. Graphics Problem in Turbo Vision

7. REQ: Turbo Vision Tutorial

8. turbo vision problem

9. Please: no Turbo Vision here!

10. Turbo Vision

11. Collections in Turbo Vision

12. Turbo Vision

 

 
Powered by phpBB® Forum Software