473,322 Members | 1,431 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,322 software developers and data experts.

memcpy : maximum buffer size

Hi,

I was wondering what factors will influence the maximum buffer sizes
for source and destination for memcpy(). Is their any limit to the
sizeof the buffer(hardware restricting it ?) OR any other limitations
like the compiler being used ?

Your thoughts are appreciated.

Thanks.

Jul 23 '05 #1
8 6773
On 20 Mar 2005 19:51:16 -0800, co*******@gmail.com wrote in
comp.lang.c++:
Hi,

I was wondering what factors will influence the maximum buffer sizes
for source and destination for memcpy(). Is their any limit to the
sizeof the buffer(hardware restricting it ?) OR any other limitations
like the compiler being used ?

Your thoughts are appreciated.

Thanks.


The only limitation the language places on memcpy() is the fact that
the size is specified by a value of type size_t, so obviously you
cannot copy a block of memory larger than the maximum value of size_t,
if you can manage to obtain a block larger than that.

Since both the source and destination of memcpy() must be objects that
your program has the right to access, the most likely real limitation
would be the largest object that you can create or allocate.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 23 '05 #2

Jack Klein wrote:
On 20 Mar 2005 19:51:16 -0800, co*******@gmail.com wrote in
comp.lang.c++:
Hi,

I was wondering what factors will influence the maximum buffer sizes for source and destination for memcpy(). Is their any limit to the
sizeof the buffer(hardware restricting it ?) OR any other limitations like the compiler being used ?

Your thoughts are appreciated.

Thanks.
The only limitation the language places on memcpy() is the fact that
the size is specified by a value of type size_t, so obviously you
cannot copy a block of memory larger than the maximum value of

size_t, if you can manage to obtain a block larger than that.
Could you pelase tell me where is size_t defined ??


Since both the source and destination of memcpy() must be objects that your program has the right to access, the most likely real limitation
would be the largest object that you can create or allocate.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html


Jul 23 '05 #3

<co*******@gmail.com>
??????:11********************@z14g2000cwz.googlegr oups.com...

Jack Klein wrote:
On 20 Mar 2005 19:51:16 -0800, co*******@gmail.com wrote in
comp.lang.c++:
Hi,

I was wondering what factors will influence the maximum buffer sizes for source and destination for memcpy(). Is their any limit to the
sizeof the buffer(hardware restricting it ?) OR any other limitations like the compiler being used ?

Your thoughts are appreciated.

Thanks.
The only limitation the language places on memcpy() is the fact that
the size is specified by a value of type size_t, so obviously you
cannot copy a block of memory larger than the maximum value of

size_t,
if you can manage to obtain a block larger than that.


Could you pelase tell me where is size_t defined ??


go to /usr/include, grep size_t then you'll find it, it depends the OS


Since both the source and destination of memcpy() must be objects

that
your program has the right to access, the most likely real limitation
would be the largest object that you can create or allocate.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html

Jul 23 '05 #4
co*******@gmail.com wrote:

Could you pelase tell me where is size_t defined ??


#include <cstddef>

Jul 23 '05 #5
modemer wrote:
Could you pelase tell me where is size_t defined ??

go to /usr/include, grep size_t then you'll find it, it depends the OS


According to the C++ Standard (18.1.2), a conforming implementation will offer
the definition of size_t by inclusion of <cstddef>
Jul 23 '05 #6
Thanks for correcting my suck C++ knowledge.

BTW, where I can get what you said C++ Standard?
"Kurt Stutsman" <ks*******@NOSPAM.sbcglobal.net> wrote in message
news:R8******************@newssvr14.news.prodigy.c om...
modemer wrote:
Could you pelase tell me where is size_t defined ??

go to /usr/include, grep size_t then you'll find it, it depends the OS


According to the C++ Standard (18.1.2), a conforming implementation will

offer the definition of size_t by inclusion of <cstddef>

Jul 23 '05 #7
modemer wrote:
Thanks for correcting my suck C++ knowledge.

BTW, where I can get what you said C++ Standard?


http://www.techstreet.com/cgi-bin/de...uct_id=1143945

I think that will take you there. The PDF is available for $18.

Also, I should warn you not to top-post (reply on top of the previous post) on
this newsgroup.
Jul 23 '05 #8

"Kurt Stutsman" <ks*******@NOSPAM.sbcglobal.net> wrote in message
news:Vx************@newssvr21.news.prodigy.com...
modemer wrote:
Thanks for correcting my suck C++ knowledge.

BTW, where I can get what you said C++ Standard?

http://www.techstreet.com/cgi-bin/de...uct_id=1143945

I think that will take you there. The PDF is available for $18.

Also, I should warn you not to top-post (reply on top of the previous

post) on this newsgroup.


Thanks a lot. I sometimes forget to move cursor to the bottom because
outlook express makes the default on the top.
Jul 23 '05 #9

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

Similar topics

3
by: cylin | last post by:
Dear all, When I use memcpy second time, it seems to be no use. There should be two "Hello,world!" strings in this buffer. I don't know what's wrong? Please help, thanks. Regards, cylin....
2
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
11
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I've noticed a few threads (full of sound and fury, signifying nothing) here recently about allocation of large memory blocks. I'm about to start on a personal pet project where I'll be using...
8
by: Spacen Jasset | last post by:
given: memcpy( dest, src, 0 ) What happens when the size paramater of memcpy is 0? Do the src and dest have to be valid? It doesn't say anything about this in the standard as far as I can...
14
by: ishmael4 | last post by:
hello! i've go two structures: --cut here-- const unsigned int max_pkg_data=5000; typedef struct pkg_ { short int info; short int size;
16
by: Jeff | last post by:
Im trying to memcpy a buffer from a filled in simple structure. When I memcpy and then print the resulting buffer, I see 7 locations that have junk before my data starts. My data structure is: ...
6
by: Juergen Wohnich | last post by:
Hello, i want to do store int variablen into a char Buffer. Like this: char Buffer; int b = 1447; int *pb; // pb deklariert als pointer auf int pb = &b; // & ist Adress operator, liefert...
18
by: Mark | last post by:
Hi List, I want to write a function to copy some data out of a hardware buffer. The hardware can change the contents of this buffer without it being written to by my function. I want to use...
14
by: somenath | last post by:
Hi All, I am trying to understand the behavior of the memcpy and memmove. While doing so I wrote a program as mentioned bellow . #include<stdio.h> #include<stdlib.h> #include<string.h> ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.