473,769 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6819
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.l earn.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.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html


Jul 23 '05 #3

<co*******@gmai l.com>
??????:11****** **************@ z14g2000cwz.goo glegroups.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.l earn.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*******@NOSP AM.sbcglobal.ne t> wrote in message
news:R8******** **********@news svr14.news.prod igy.com...
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*******@NOSP AM.sbcglobal.ne t> wrote in message
news:Vx******** ****@newssvr21. news.prodigy.co m...
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
2824
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
28600
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
24145
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 memchr(), memcmp(), memmove() a lot. Is there an ANSI C maximium size for character arrays which are guaranteed to succeed, assuming the machine has sufficient memory? And will the memxxx() functions work with that size? I'm looking at hopefully...
8
16002
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 tell. So presumably they do have to be valid even when the size is 0.
14
3209
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
2815
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: struct command_pkt { char command_num; char command; }; typedef command_pkt COMMAND;
6
36573
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 Adresse von b memcpy( Buffer, pb, 4 );
18
21603
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 memcpy to unload the data. Do I need to specify the source data as volatile in this case? What is the correct syntax for specifying that the data pointed to by the source pointer is volatile and not the pointer itself?
14
2804
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> #define SIZE_OF_DST 3 int main(void)
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9987
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.