home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!lax.pe-nelson.com!lax!twbrown
- From: twbrown@PE-Nelson.COM (Tom W. Brown)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Re: Borland and Memory
- Message-ID: <712@lax.lax.pe-nelson.com>
- Date: 15 Dec 92 17:37:17 GMT
- References: <1gilfkINNjmd@crcnis1.unl.edu> <BzA2sp.199@newsserver.technet.sg> <BzAyI5.BrH@world.std.com> <1992Dec15.144205.16197@mksol.dseg.ti.com>
- Sender: news@lax.pe-nelson.com
- Distribution: usa
- Organization: PE-Nelson
- Lines: 41
-
- In article <1992Dec15.144205.16197@mksol.dseg.ti.com>, duitz@mksol.dseg.ti.com (mitchel n duitz) writes:
- |> I seem to have a point in my code, where I am stuck.
- |>
- |> I do a lot of new and delete inside my code, and first,
- |> I do see a memory leak somewhere, but I can;t pin it down.
- |>
- |> The problem I have is that the program just spins. This
- |> can happen in two different places - either when I declare ofstream ofs(name),
- |> or when I'm in a loop allocating a 2 dimensional array - similar to the
- |> following
- |>
- |> float **kalamazoo
- |>
- |> kalamazoo = new float *[150];
- |> for(i=0;i<150;i++)
- |> kalamzoo[i]=new float[30];
- |>
- |> It seems to just hang inside this loop.
- |> PLEASE HELP - ANY AND ALL HELP APPRECIATED.
- |> mitch
-
- Try using large model (if you're not already). Based on some investigation
- on a discussion over in comp.os.ms-windows.programmer.tools I've seen this
- behavior when attempting to allocate (malloc) memory in medium model.
-
- I've not confirmed it, but I believe Borland's malloc/free may have problems
- when in Windows, but their farmalloc/farfree don't. The C++ operator new
- and delete use the appropriate malloc package for their implementation (or
- they both share some underlying internal routines).
-
- Note, also, that the above loop allocates over 18000 bytes of storage, if
- this is coming from the local heap then you may simply not have enough room
- there (depends on how much global and static data you have as well as the
- size of the stack).
-
-
- ----------------------------------------------------------------------------
- Tom Brown | "She turned me into a newt...
- PE Nelson Systems | ... I got better"
- twbrown@pe-nelson.com | Monty Python and the Holy Grail
- ----------------------------------------------------------------------------
-