473,405 Members | 2,310 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,405 software developers and data experts.

string size greater than page size?

wat will happen to a std string function like strcmp etc when the size
of the string is greater than page size of the OS?
A bigger question is how will they be even stored? (if at all they can
be stored)
My guess is that this is not an issue as I assume we can malloc like
1MB(>page size), so when we try to access it,
both the pages are brought to memory. Does malloc by default tries to
allocate in the same page? If so, how will it deal with fragmentation?

Pardon me if the question doesnt make sense.

Apr 26 '07 #1
3 1667
On Apr 27, 12:03 am, lazy <arunm...@gmail.comwrote:
wat will happen to a std string function like strcmp etc when the size
of the string is greater than page size of the OS?
A bigger question is how will they be even stored? (if at all they can
be stored)
My guess is that this is not an issue as I assume we can malloc like
1MB(>page size), so when we try to access it,
both the pages are brought to memory. Does malloc by default tries to
allocate in the same page? If so, how will it deal with fragmentation?

Pardon me if the question doesnt make sense.
The standard library functions always behave the way it is described
in the C Standard.

Apr 27 '07 #2
lazy wrote:
wat will happen to a std string function like strcmp etc when the size
of the string is greater than page size of the OS?
Nothing. The standard functions needn't care -- or even know -- about
things like "the page size of the OS".
A bigger question is how will they be even stored?
As a sequence of bytes.
My guess is that this is not an issue as I assume we can malloc like
1MB(>page size),
How much space one can malloc depends on the underlying implementation.
It is, however, unlikely that malloc would restrict itself to space
less than the "page size". Why should it?
so when we try to access it,
both the pages are brought to memory. Does malloc by default tries to
allocate in the same page? If so, how will it deal with fragmentation?
It doesn't have to do anything, in general. OS's that have "page sizes"
tend to go to a great deal of trouble to arrange that programs running
under them don't need to know about them: that is rather the point about
memory mapping, after all.

--
A rock is not a fact. A rock is a rock.

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

Apr 27 '07 #3
"lazy" <ar******@gmail.comha scritto nel messaggio
news:11**********************@c18g2000prb.googlegr oups.com...
wat will happen to a std string function like strcmp etc when the size
of the string is greater than page size of the OS?
A bigger question is how will they be even stored? (if at all they can
be stored)
My guess is that this is not an issue as I assume we can malloc like
1MB(>page size), so when we try to access it,
both the pages are brought to memory. Does malloc by default tries to
allocate in the same page? If so, how will it deal with fragmentation?

Pardon me if the question doesnt make sense.
You can't know (as far as the C programming language is concerned),
and you shouldn't care. If the malloc returns a non-null pointer,
you can use as many bytes from there on as you asked it to
allocate. You don't need to know where they are.
Apr 27 '07 #4

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

Similar topics

25
by: Jason | last post by:
Hi, below is example code which demonstrates a problem I have encountered. When passing a number to a function I compare it with a string's size and then take certain actions, unfortunately during...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
7
by: rn5a | last post by:
I am giving users the option to upload files from their hard disk to the server but only those files will be uploaded whose size is less tha or equal to 1 MB. I am using the ASP.NET FileUpload...
1
by: colmkav | last post by:
Can someone tell me how to check the size of an access database in VB code? I want to write code to check the size and then compact it if it is greater than this size.
53
by: Jonas Smithson | last post by:
In his book "CSS: The Definitive Guide" 2nd edition (pgs. 116-117), Eric Meyer has an interesting discussion about "font-size-adjust" that was evidently dropped in CSS 2.1 due to browser...
5
by: Angus | last post by:
Hello I am using ifstream to load the contents of a text file into a char* variable. I am allocating using new with the file size as amount to allocate. My problem is that the variable...
7
by: Bill H | last post by:
When I do website design I have my screen (on a PC) set for 1600 x 1200 or greater resolution so that I can have as many windows open as I need and not have to flip between them. The issue I have...
66
by: dattts | last post by:
what is the difference between a single character and a string consisting only one character
3
by: tcsvikr | last post by:
Hi, The string::capacity() returns the size of the allocated space, which is either equal or greater than this content size. My question is: Is capacity assigning equal or greater than content size...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.