FIND SIZE OF MEMORY ALLOCATE???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi !

I think he wanted to know how much memory was allocated in the malloc
request, like the _msize( ptr) function on Visual Studio, as far as I know
there is no way to do that with gcc.

Mikael

----- Original Message -----
From: "Ivan Jager" <ivanj@netvision.com.py>
To: <redhat-devel-list@redhat.com>
Sent: Tuesday, February 26, 2002 2:32 PM
Subject: Re: FIND SIZE OF MEMORY ALLOCATE???


> Vimol wrote:
> >
> > How to find out the size of memory allocated to a pointer???
> >
> > Example:
> >
> > int
> > MyFunc(char *str)
> > {
> >         int sizemem;
> >
> >         // Here how to find out the size of str memory ??
> >
> >         sizemem =  _____    /// One function to find out the size of str
memory .
> > }
>
> If you want the size of the pointer try sizeof(). If you want the lenght
> of the string use strlen().
>
> --
> Ivan Jager
>
>
>
> _______________________________________________
> Redhat-devel-list mailing list
> Redhat-devel-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list
>





[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux