malloc

Discussion in 'C Programming' started by cs, Nov 7, 2005.

  1. cs

    cs Guest

    in chapter 8.7 of K&R2(an example of memory allocator)
    if i write NALLOC==1024 (is it 1K?) in my pc (that has 40MegaBytes of
    memory) and i ask memory for many arrays of more than 1K there is the
    problem that Pc reads the disk (seems doesn't have memory).
    instead if i write
    NALLOC==1024*1024*2 (is it 2.048 MegaBytes?)
    all seems right.
    Where is the error?
    I have an error in that malloc function?
    I have an error in the function that give memory to malloc function?
    I have an error in the function that call malloc function?
    NALLOC is not right. What value is right for NALLOC macro value?
    Thank you if you can read in the crystal ball :)
    cs, Nov 7, 2005
    #1
    1. Advertising

  2. On Mon, 07 Nov 2005 07:31:24 +0100, in comp.lang.c , cs <>
    wrote:

    >Thank you if you can read in the crystal ball :)


    I can't. And I suspect nobody else can either. Post some actual code
    instead.
    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Nov 7, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    13
    Views:
    683
  2. ravi
    Replies:
    0
    Views:
    439
  3. Peter
    Replies:
    34
    Views:
    1,911
    Richard Tobin
    Oct 22, 2004
  4. porting non-malloc code to malloc

    , Feb 18, 2005, in forum: C Programming
    Replies:
    3
    Views:
    466
    Walter Roberson
    Feb 19, 2005
  5. Johs32

    to malloc or not to malloc??

    Johs32, Mar 30, 2006, in forum: C Programming
    Replies:
    4
    Views:
    311
    Captain Winston
    Mar 30, 2006
Loading...

Share This Page