a problem about windows memory

Discussion in 'C Programming' started by richi, Sep 25, 2008.

  1. richi

    richi Guest

    Hi everyone,

    I am sorry, my english is not good!

    I found a problem about memory. In a function I malloced more memory than
    before
    that is 4.5625Kb in theory. Then I watched the memory size of the function
    in Linux and
    Unix through the command of "ps". After comparing with the early memory
    size of
    the function which didn't have change, I found the increaseded size was
    different! In Linux and Unix
    the size is about 4Kb, but in windows the size watched from task manager is
    far more
    than 4Kb.

    can anyone help me and explain the phenomenon,please?
    richi, Sep 25, 2008
    #1
    1. Advertising

  2. richi

    jacob navia Guest

    richi wrote:
    > Hi everyone,
    >
    > I am sorry, my english is not good!
    >
    > I found a problem about memory. In a function I malloced more memory
    > than before
    > that is 4.5625Kb in theory. Then I watched the memory size of the
    > function in Linux and
    > Unix through the command of "ps". After comparing with the early memory
    > size of
    > the function which didn't have change, I found the increaseded size was
    > different! In Linux and Unix
    > the size is about 4Kb, but in windows the size watched from task manager
    > is far more
    > than 4Kb.
    >
    > can anyone help me and explain the phenomenon,please?
    >


    Probably under linux your memory is just reserved, not really allocated
    until you try to use it. Under windows, probably more memory is
    allocated right away.


    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
    jacob navia, Sep 25, 2008
    #2
    1. Advertising

  3. richi

    Ian Collins Guest

    jacob navia wrote:
    > richi wrote:
    >> Hi everyone,
    >>
    >> I am sorry, my english is not good!
    >>
    >> I found a problem about memory. In a function I malloced more memory
    >> than before
    >> that is 4.5625Kb in theory. Then I watched the memory size of the
    >> function in Linux and
    >> Unix through the command of "ps". After comparing with the early memory
    >> size of
    >> the function which didn't have change, I found the increaseded size was
    >> different! In Linux and Unix
    >> the size is about 4Kb, but in windows the size watched from task manager
    >> is far more
    >> than 4Kb.
    >>
    >> can anyone help me and explain the phenomenon,please?


    Try asking on comp.unix.programmer. How the OS manages memory is
    platform specific.

    > Probably under linux your memory is just reserved, not really allocated
    > until you try to use it. Under windows, probably more memory is
    > allocated right away.


    Linux can do this, but Unix versions tend not to. The OP doesn't say
    which one was used.

    --
    Ian Collins.
    Ian Collins, Sep 25, 2008
    #3
  4. richi

    richi Guest

    thank for your answer !
    but I had tried hunderds of times, and the result is the same.
    Under Linux and HP-Unix, the increased memory size was about 4Kb at all
    times
    But Under Windows the increased was not fixed, e.g. 4Kb, 8Kb, 16Kb.
    I don't know why! Does it probably relate to the page size of operating
    system?


    "jacob navia" <> wrote in message
    news:gbfkp2$i8t$...
    > richi wrote:
    >> Hi everyone,
    >>
    >> I am sorry, my english is not good!
    >>
    >> I found a problem about memory. In a function I malloced more memory
    >> than before
    >> that is 4.5625Kb in theory. Then I watched the memory size of the
    >> function in Linux and
    >> Unix through the command of "ps". After comparing with the early memory
    >> size of
    >> the function which didn't have change, I found the increaseded size was
    >> different! In Linux and Unix
    >> the size is about 4Kb, but in windows the size watched from task manager
    >> is far more
    >> than 4Kb.
    >>
    >> can anyone help me and explain the phenomenon,please?
    >>

    >
    > Probably under linux your memory is just reserved, not really allocated
    > until you try to use it. Under windows, probably more memory is
    > allocated right away.
    >
    >
    > --
    > jacob navia
    > jacob at jacob point remcomp point fr
    > logiciels/informatique
    > http://www.cs.virginia.edu/~lcc-win32
    richi, Sep 25, 2008
    #4
  5. richi

    Ian Collins Guest

    richi wrote:

    [Please don't top post]

    > "jacob navia" <> wrote in message
    > news:gbfkp2$i8t$...
    >> richi wrote:
    >>> Hi everyone,
    >>>
    >>> I am sorry, my english is not good!
    >>>
    >>> I found a problem about memory. In a function I malloced more memory
    >>> than before
    >>> that is 4.5625Kb in theory. Then I watched the memory size of the
    >>> function in Linux and
    >>> Unix through the command of "ps". After comparing with the early memory
    >>> size of
    >>> the function which didn't have change, I found the increaseded size was
    >>> different! In Linux and Unix
    >>> the size is about 4Kb, but in windows the size watched from task manager
    >>> is far more
    >>> than 4Kb.
    >>>
    >>> can anyone help me and explain the phenomenon,please?
    >>>

    >>
    >> Probably under linux your memory is just reserved, not really allocated
    >> until you try to use it. Under windows, probably more memory is
    >> allocated right away.
    >>

    > thank for your answer !
    > but I had tried hunderds of times, and the result is the same.
    > Under Linux and HP-Unix, the increased memory size was about 4Kb at all
    > times
    > But Under Windows the increased was not fixed, e.g. 4Kb, 8Kb, 16Kb.
    > I don't know why! Does it probably relate to the page size of operating
    > system?
    >

    Could be, try an OS group, you'll get more sense there.

    >> --
    >> jacob navia
    >> jacob at jacob point remcomp point fr
    >> logiciels/informatique
    >> http://www.cs.virginia.edu/~lcc-win32

    >

    Please don't quote signature blocks.

    --
    Ian Collins.
    Ian Collins, Sep 25, 2008
    #5
  6. richi

    richi Guest

    thanks for your advice!
    "Ian Collins" <> wrote in message
    news:...
    > jacob navia wrote:
    >> richi wrote:
    >>> Hi everyone,
    >>>
    >>> I am sorry, my english is not good!
    >>>
    >>> I found a problem about memory. In a function I malloced more memory
    >>> than before
    >>> that is 4.5625Kb in theory. Then I watched the memory size of the
    >>> function in Linux and
    >>> Unix through the command of "ps". After comparing with the early memory
    >>> size of
    >>> the function which didn't have change, I found the increaseded size was
    >>> different! In Linux and Unix
    >>> the size is about 4Kb, but in windows the size watched from task manager
    >>> is far more
    >>> than 4Kb.
    >>>
    >>> can anyone help me and explain the phenomenon,please?

    >
    > Try asking on comp.unix.programmer. How the OS manages memory is
    > platform specific.
    >
    >> Probably under linux your memory is just reserved, not really allocated
    >> until you try to use it. Under windows, probably more memory is
    >> allocated right away.

    >
    > Linux can do this, but Unix versions tend not to. The OP doesn't say
    > which one was used.
    >
    > --
    > Ian Collins.
    richi, Sep 25, 2008
    #6
  7. richi

    richi Guest

    Sorry. I am a new fish here!

    What is the meaning of ~top post~?

    How to avoid ~top post~?
    richi, Sep 25, 2008
    #7
  8. richi

    CBFalconer Guest

    richi wrote:
    >
    > I am sorry, my english is not good!
    >
    > I found a problem about memory. In a function I malloced more
    > memory than before that is 4.5625Kb in theory. Then I watched the

    ....

    Please explain how you can allocate 1/2 a byte. Either in practice
    or in theory.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
    CBFalconer, Sep 25, 2008
    #8
  9. richi

    CBFalconer Guest

    richi wrote:
    >
    > Sorry. I am a new fish here! What is the meaning of ~top post~?
    > How to avoid ~top post~?


    Please do not top-post. Your answer belongs after (or intermixed
    with) the quoted material to which you reply, after snipping all
    irrelevant material. See the following links:

    <http://www.catb.org/~esr/faqs/smart-questions.html>
    <http://www.caliburn.nl/topposting.html>
    <http://www.netmeister.org/news/learn2quote.html>
    <http://cfaj.freeshell.org/google/> (taming google)
    <http://members.fortunecity.com/nnqweb/> (newusers)

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
    CBFalconer, Sep 25, 2008
    #9
  10. CBFalconer <> writes:

    > richi wrote:
    >>
    >> I am sorry, my english is not good!
    >>
    >> I found a problem about memory. In a function I malloced more
    >> memory than before that is 4.5625Kb in theory. Then I watched the

    > ...
    >
    > Please explain how you can allocate 1/2 a byte. Either in practice
    > or in theory.


    Why do you think the OP is claiming that? (4672 is exactly 4.5625Kb
    using the usual computer meaning of K.)

    --
    Ben.
    Ben Bacarisse, Sep 25, 2008
    #10
  11. richi

    CBFalconer Guest

    Ben Bacarisse wrote:
    > CBFalconer <> writes:
    >> richi wrote:
    >>>
    >>> I am sorry, my english is not good!
    >>>
    >>> I found a problem about memory. In a function I malloced more
    >>> memory than before that is 4.5625Kb in theory. Then I watched the

    >> ...
    >>
    >> Please explain how you can allocate 1/2 a byte. Either in practice
    >> or in theory.

    >
    > Why do you think the OP is claiming that? (4672 is exactly 4.5625Kb
    > using the usual computer meaning of K.)


    There you are. I am old fashioned and old, and tend to use decimal
    orientation. :)

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
    CBFalconer, Sep 26, 2008
    #11
  12. richi

    MisterE Guest


    >> Please explain how you can allocate 1/2 a byte. Either in practice
    >> or in theory.

    >
    > Why do you think the OP is claiming that? (4672 is exactly 4.5625Kb
    > using the usual computer meaning of K.)


    and here i was thinking he had some sort of nibble based computer
    MisterE, Sep 26, 2008
    #12
    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. Mahesh Prasad
    Replies:
    1
    Views:
    690
    Tom Wells
    Feb 22, 2004
  2. Gavin Williams
    Replies:
    0
    Views:
    568
    Gavin Williams
    Jun 24, 2004
  3. Cy Huckaba
    Replies:
    1
    Views:
    1,131
    Xie Xiao
    Jun 26, 2003
  4. Replies:
    3
    Views:
    444
  5. Florent Coué
    Replies:
    3
    Views:
    877
    Larry Barowski
    Apr 28, 2004
Loading...

Share This Page