NEED HELP WITH UNITS!!! 
Author Message
 NEED HELP WITH UNITS!!!

I have a program in Pascal 7 that calls other units, and they work fine
until I try to exit out of the unit. Then it crashes and says that there
was not enough heap memory!?! What do I do? I tried allocating more heap
memory to my program and the unit, but it didn't help. Thanks...



Wed, 18 Jun 1902 08:00:00 GMT  
 NEED HELP WITH UNITS!!!

Quote:
> I have a program in Pascal 7 that calls other units, and they work fine
> until I try to exit out of the unit. Then it crashes and says that there
> was not enough heap memory!?! What do I do? I tried allocating more heap
> memory to my program and the unit, but it didn't help. Thanks...

   You're talking "apples and oranges" here, because the problems aren't
related to "exiting from Units".
   Units are pnly libraries of compiled code and data which your program
can use - to be bound into your .EXE program file - and which become part
of your compiled program.  What the code (which is referenced) in a Units
does is, well, what it does - it's just more code/logic what the program
does.  The fact that your program aborts with a Heap Overflow error has
nothing to do with the uses of Units, it's the logic or way the Unit
procedure/function is used by the program, and the problem would occurs
if that code were in the main program.
   Looking at the Heap Overflow error: it means that something being
executed in the program is attempting to allocate more Heap memory than
is available at the time.  It might be logic in your program, or ir might
be logic which is being referenced in one of the Units - it doesn't
matter here.  Something _you're_ doing is trying to use too much Heap,
and that's where you must change something.  I don't believe it has
anything to do with using Units - but it could be something in the logic
being invoked.
   What sort of problems might cause this?  I don't really know here,
because you didn't state anything about what your program does, nor
anything regarding the functionality being referenced in the Units.  
However, common causes include:
  1. Executing a program which normally uses a lot of Heap while in the
IDE.  This will never work, since the IDE consumes a lot of memory, and
there's not enough Heap to satisfy the program's valid needs.  Compile
the program to Disk and execute it from DOS.
  2. You have a recursive routine being used, and the data (or logic) is
bad.  This is a doubtful reason, but recursive calls which use GetMem or
New can exhaust the Heap.
  3. Your program really _does_ use too much Heap, because you've
declared structures unreasonably large.  Note that even under optimal
conditions, you'll probably not be able to use more than 400K of Heap,
given a normal DOS environment and program size (code, data, constants,
Stack, etc.).  You might just be trying to do too much in one program...
   If you've tried to (1) execute as a DOS command, (2) use {$M
8192,0,655360}, and (3) are confident you don't have a logic or data bug
in your New/GetMem usage, then it's likely you're just attempting too
much in one program...and solutions are quite difficult in such cases.


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

 Relevant Pages 

1. Need Help with mouse unit!

2. NEED A HELP! (unit)

3. Need help with PIX2GUI unit.

4. Need help with pascal units..

5. Help: I need tpw72 unit

6. UNITS, need help running this

7. Need help, i want send pointer(^) to a unit

8. A queue obj unit. Need help/

9. TP6 units - Help needed

10. Newbie needs help with Printers Unit!

11. Help needed about borland pascal :multiple unit directories

12. HELP!!! I need a SB unit

 

 
Powered by phpBB® Forum Software