473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems reserving memory with the 'malloc' command

Hi

I recently downloaded Turbo C v2.01 from the borland web site where
its being given out for free. Has anyone else tried this?

Ive been using it for some months now and hav'nt noted any probems.
its very usable even without the user manual. My one problem is when
reserving memory with the 'malloc' command in the huge memory model.
your only allowed 180k about with a small test program. other texts
claim that turbo c can use at least 1 meg. base memory is 640k and so
it means that at least 460k is being used by T.C., the OS, the program
in memory, ect....

I've also had some lock-ups with the program im working on when i
reserve over 60k.

Anyone know how much memory this version of TC can actualy use?

Thanks.
Jan 11 '08 #1
9 2015
an********@gmail.com wrote:
Hi

I recently downloaded Turbo C v2.01 from the borland web site where
its being given out for free. Has anyone else tried this?

Ive been using it for some months now and hav'nt noted any probems.
its very usable even without the user manual. My one problem is when
reserving memory with the 'malloc' command in the huge memory model.
your only allowed 180k about with a small test program. other texts
claim that turbo c can use at least 1 meg. base memory is 640k and so
it means that at least 460k is being used by T.C., the OS, the program
in memory, ect....

I've also had some lock-ups with the program im working on when i
reserve over 60k.

Anyone know how much memory this version of TC can actualy use?

Thanks.
You are using a 16 bit mode, DOS program that can use up to
500K maybe more, maybe less. Try running your programs after
unloading the development environment of course.

You can do BIG programs within that environment.

I wrote a lisp interpreter with it, using the overlay feature.
It featured most of Common Lisp, even with a bignum package
and graphics.

But it is COMPLETELY outdated now. You are wasting your time.
Fetch another compiler from the web and program under a 32 bit
system. There you can have a more sensible environment
(forget the "hug" model with its 400K and start programming
in the flat model with 2GB)

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jan 11 '08 #2
an********@gmail.com wrote:
Hi

I recently downloaded Turbo C v2.01 from the borland web site where
its being given out for free. Has anyone else tried this?

Ive been using it for some months now and hav'nt noted any probems.
its very usable even without the user manual. My one problem is when
reserving memory with the 'malloc' command in the huge memory model.
your only allowed 180k about with a small test program. other texts
claim that turbo c can use at least 1 meg. base memory is 640k and so
it means that at least 460k is being used by T.C., the OS, the program
in memory, ect....
Compiler specific questions are not appropriate here. You need to find
a Borland newsgroup.

Brian
Jan 11 '08 #3
an********@gmail.com said:
Hi

I recently downloaded Turbo C v2.01 from the borland web site where
its being given out for free. Has anyone else tried this?
Yes.
Ive been using it for some months now and hav'nt noted any probems.
Good!
its very usable even without the user manual.
Agreed.
My one problem is when
reserving memory with the 'malloc' command in the huge memory model.
your only allowed 180k about with a small test program.
That sounds pretty huge to me. I forget - how big is size_t (bit count) in
Turbo?
other texts
claim that turbo c can use at least 1 meg.
Not necessarily all in one lump, though. In any case, as long as you can
create an object at least 32767 bytes in size, Turbo C has fulfilled its
conformance obligations.
base memory is 640k and so
it means that at least 460k is being used by T.C., the OS, the program
in memory, ect....
....Well, not necessarily. It is also possible that Turbo C is making those
memory assumptions about its environment (e.g. the amount of memory taken
by the OS), even though they may not be valid nowadays. No programmer is a
perfect prophet.
>
I've also had some lock-ups with the program im working on when i
reserve over 60k.
That might conceivably be due to bugs in your code, wouldn't you agree?
Anyone know how much memory this version of TC can actualy use?
It only *has* to give you 32767 bytes. Anything more than that, you should
treat as a welcome bonus.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jan 12 '08 #4
Default User said:
an********@gmail.com wrote:
>Hi

I recently downloaded Turbo C v2.01 from the borland web site where
its being given out for free. Has anyone else tried this?

Ive been using it for some months now and hav'nt noted any probems.
its very usable even without the user manual. My one problem is when
reserving memory with the 'malloc' command in the huge memory model.
your only allowed 180k about with a small test program. other texts
claim that turbo c can use at least 1 meg. base memory is 640k and so
it means that at least 460k is being used by T.C., the OS, the program
in memory, ect....

Compiler specific questions are not appropriate here. You need to find
a Borland newsgroup.
A topical reply was possible in this case. See elsethread. I invite you to
give some thought as to whether sending people packing is necessarily the
best way to teach them the value of standard C.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jan 12 '08 #5
an********@gmail.com wrote:
>
I recently downloaded Turbo C v2.01 from the borland web site
where its being given out for free. Has anyone else tried this?

Ive been using it for some months now and hav'nt noted any
probems. its very usable even without the user manual. My one
problem is when reserving memory with the 'malloc' command in
the huge memory model. your only allowed 180k about with a small
test program. other texts claim that turbo c can use at least 1
meg. base memory is 640k and so it means that at least 460k is
being used by T.C., the OS, the program in memory, ect....
It has, IIRC, two possible requirements. The smaller is when it is
working entirely in memory and prepares object code that the
resident debugger can handle. This means that the basic IDE never
gets out of memory. The larger is when it always prepares the
object code on the disk, when it has the OS limitations only.

So look for options such as 'Compile to disk' and set them if you
need the space.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 12 '08 #6
Richard Heathfield wrote:
Default User said:
Compiler specific questions are not appropriate here. You need to
find a Borland newsgroup.

A topical reply was possible in this case. See elsethread. I invite
you to give some thought as to whether sending people packing is
necessarily the best way to teach them the value of standard C.

I'm sure you thought your reply was illuminating for the OP, but
somehow I doubt it.


Brian
Jan 12 '08 #7
Default User said:
Richard Heathfield wrote:
>Default User said:
Compiler specific questions are not appropriate here. You need to
find a Borland newsgroup.

A topical reply was possible in this case. See elsethread. I invite
you to give some thought as to whether sending people packing is
necessarily the best way to teach them the value of standard C.


I'm sure you thought your reply was illuminating for the OP, but
somehow I doubt it.
Potentially illuminating, my dear chap, potentially illuminating. More
illuminating than telling him to push off.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jan 12 '08 #8
jacob navia wrote:
an********@gmail.com wrote:
Hi

I recently downloaded Turbo C v2.01 from the borland web site where
its being given out for free. Has anyone else tried this?

Ive been using it for some months now and hav'nt noted any probems.
its very usable even without the user manual. My one problem is when
reserving memory with the 'malloc' command in the huge memory model.
your only allowed 180k about with a small test program. other texts
claim that turbo c can use at least 1 meg. base memory is 640k and so
it means that at least 460k is being used by T.C., the OS, the program
in memory, ect....

I've also had some lock-ups with the program im working on when i
reserve over 60k.

Anyone know how much memory this version of TC can actualy use?

Thanks.

You are using a 16 bit mode, DOS program that can use up to
500K maybe more, maybe less. Try running your programs after
unloading the development environment of course.

You can do BIG programs within that environment.

I wrote a lisp interpreter with it, using the overlay feature.
It featured most of Common Lisp, even with a bignum package
and graphics.

But it is COMPLETELY outdated now. You are wasting your time.
Fetch another compiler from the web and program under a 32 bit
system. There you can have a more sensible environment
(forget the "hug" model with its 400K and start programming
in the flat model with 2GB)
Thanks to everyone for their advices.

To explain the situation, my computer runs Windows 95 and only has 16
MB of RAM, so I don't really need to move up to 2 GB address spaces :)

Actually I have some problem with my Windows installation, and it's
really slow and sluggish when I start up, and there's huge amount of
network activity - very expensive on ppm dial up :( So I usually just
boot up to good old MS-DOS.

There are lots of things I really like about DOS, like how you can
make a pointer and just write directly to video memory and whatever -
everything's too much more constrained in Windows.

Anyway I tried what people advised and found I could get up to about
400 KB or 500 KB by making seperate malloc calls instead of a big call
- weird, huh? So thanks for the suggestions.

Jan 14 '08 #9
anon856...@gmail.com wrote:
....
Anyway I tried what people advised and found I could get up to about
400 KB or 500 KB by making seperate malloc calls instead of a big call
- weird, huh? ...
Not particularly. Depending upon your implementation, it's not at all
unusual for the largest single block you can allocate to be
substantially smaller than the total space you can allocate if you do
so in smaller pieces.
Jan 14 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: stephenma7 | last post by:
Hi, everybody. I am new here. I have encountered these many problems for the last couple of days. I have Linux Fedora Core 3(Gnu G++ 3.4.2), Linux Fedora Core 2 (Gnu G++ 3.3.3), Red Hat 9 (Gnu...
11
by: binaya | last post by:
Dear all, Say I allocate a block of memory using the command malloc.I have a question. Can I deallocate certain portion of it only during runtime ? For eg: Say I allocate 5 pointers to int...
4
by: Evangelista Sami | last post by:
hello all i want to know in my program the amount of memory allocated by malloc() calls so i "overloaded" the malloc functions to increment a counter of memory used (no call to free is done)....
18
by: __PPS__ | last post by:
Hello, I'm a university student and I'm preparing for my final today. I'm reading course notes, I found completely strange piece of code. It makes me laugh, I think the teacher needs to prepare...
11
by: seberino | last post by:
Suppose a C extension locally built an array of PyObject* 's as follows... my_array = malloc(n * sizeof(PyObject*)); for (i = 0; i < n; i++) { my_array = PyList_New(0); } Q1: Must I do a...
1
by: wolverine | last post by:
Hi Let me first of all tell that this problem is not specific to a compiler like gcc. It even comes in windows. So please dont regard the question as off topic. I am posting a code using stl. I...
2
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres...
1
by: vectorizor | last post by:
Hello all, I am writing a Photoshop plug-in on Windows, and I am having trouble with allocating memory. Essentially, the code performs a very complex operation on the image, so 9 buffer planes...
5
by: Mahendra Kumar Kutare | last post by:
I am trying to implement a webserver with boss-worker model thread pool implementation - I have a header declaration threadpool.h as - typedef struct threadpool_work { void (*routine) ();...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.