473,761 Members | 7,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to malloc 2G ram? in freebsd, win2k

hi
i try to malloc 2G size mem . so i wirte code like that.
it failt in freebsd 5.3 and win2k

what's bug in my code ? how can i change it ?

thank all :)
benjiam
///////////////////////////////////////////////
#include <iostream>
using namespace std;

#include <cstdlib>
const int len = 2000;
int main()
{
char* p1[len];
static int size = int (1<<20);
cout << size << endl;
for (int i =0 ; i < len ;i++)
{
p1[i] = new char [size];
cout << size << endl;
char *tp = p1[i];
for ( int x =0 ; x< (size-1); x++)
{
//cout << x << endl;
*(tp+x) = char( (x%26)+ 48);

}
*(tp+size-1) =0;
cout << "p [" << i << "]ok" << endl;
}

for (int i =0 ; i < len ;i++)
{
delete [] p1[i];
}
return 0;
}
////////////////////////////////////////////
Nov 14 '05
23 3025
<ch***********@ hotmail.com> writes:
[snip]

Once again, "chong19782002" , please stop changing the subject header
when you post a followup. The subject header is not a place to make
short comments, it's the place to describe what the discussion is
about, and it should almost always remain exactly the same (apart from
the "Re: " that your newsreader will add) for every article in a
thread.

And please don't top-post. Any new text you write belongs *after* any
quoted material, or interspersed with it if you're responding to
individual points. See almost every article in this newsgroup for
examples of how to do this.

These are not arbitrary rules that we impose for the fun of it;
they're conventions that make it possible to carry on a coherent
conversation.

If you want help, please do us all the courtesy of posting properly.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #21
o! i see, i will stop change subject header.

please don't top-post,
i did not do it. i always post a followup. it is a followup in
my outlook

thanks for your advice.

"Keith Thompson" <ks***@mib.or g> ??????:ln****** ******@nuthaus. mib.org...
<ch***********@ hotmail.com> writes:
[snip]

Once again, "chong19782002" , please stop changing the subject header
when you post a followup. The subject header is not a place to make
short comments, it's the place to describe what the discussion is
about, and it should almost always remain exactly the same (apart from
the "Re: " that your newsreader will add) for every article in a
thread.

And please don't top-post. Any new text you write belongs *after* any
quoted material, or interspersed with it if you're responding to
individual points. See almost every article in this newsgroup for
examples of how to do this.

These are not arbitrary rules that we impose for the fun of it;
they're conventions that make it possible to carry on a coherent
conversation.

If you want help, please do us all the courtesy of posting properly.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this.

Nov 14 '05 #22
<ch***********@ hotmail.com> writes:
o! i see, i will stop change subject header.

please don't top-post,
i did not do it. i always post a followup. it is a followup in
my outlook

thanks for your advice.

"Keith Thompson" <ks***@mib.or g> ??????:ln****** ******@nuthaus. mib.org...
<ch***********@ hotmail.com> writes:
[snip]

Once again, "chong19782002" , please stop changing the subject header
when you post a followup. The subject header is not a place to make
short comments, it's the place to describe what the discussion is
about, and it should almost always remain exactly the same (apart from
the "Re: " that your newsreader will add) for every article in a
thread.

And please don't top-post. Any new text you write belongs *after* any
quoted material, or interspersed with it if you're responding to
individual points. See almost every article in this newsgroup for
examples of how to do this.

These are not arbitrary rules that we impose for the fun of it;
they're conventions that make it possible to carry on a coherent
conversation.

If you want help, please do us all the courtesy of posting properly.


You just top-posted again. As you can see from the above (your
previous article, quoted in full), you posted your new comments
*above* the text quoted from the previous article; that's called
top-posting. Any new text you write should be *below* any quoted
text, and you should delete anything that's not relevant to your
followup.

I think Outlook encourages top-posting by placing the cursor above the
quoted text. You still need to write below the quoted text.

Please read the following:

<http://www.caliburn.nl/topposting.html >
<http://www.netmeister. org/news/learn2quote.htm l>

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #23
On Fri, 25 Mar 2005 10:00:15 +0800, in comp.lang.c ,
<ch***********@ hotmail.com> wrote:
o! i see, i will stop change subject header.

please don't top-post,
i did not do it. i always post a followup. it is a followup in
my outlook


top posting is when you write your reply at the top of the screen
above any text you are replying to. In CLC, we very much prefer you to
put your BELOW the text of the message you're replying to.

You should also remove any text that is not relevant to your reply,
like I have done here by removing everything below this point except
my sig block....

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 14 '05 #24

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

Similar topics

10
2317
by: pembed2003 | last post by:
Hi, If I have the folllowing: char* p = malloc(5); memset(p,-1,5); *p = 0; printf("%d\n",strlen(p)); free(p); It will print 0. Is there a way to retrive the initial size of memory
2
1432
by: dsptechie | last post by:
I wanted to how exactly malloc() function works. I came to know that malloc() allocates memory only in powers of 2. i.e if asked for say 17 bytes , in the process, it allocates 32 bytes and returns 17 bytes so 15 bytes are wasted... Is this true...If anybody knows the algorithm details of malloc() plase share the same. Is this one of the reason why malloc() is not generally preferred in embedded systems..?
40
540
by: ramu | last post by:
Hi, what happens when i run the below code? main() { int *p; while(1) p= (int *)malloc(1000); } Do i get segmentation fault?
37
3202
by: ravi.cs.2001 | last post by:
Hi all, I m relatively new to C. I have few queries related to malloc(): #1. When we perform malloc(), the memory allocated dynamically comes from the heap area of the process in concern. Well, we then say that the heap has shrinked. my query is: Is it that the heap physically does not shrink but the perticular nodes are marked 'ALLOCATED' and for subsequent calls to malloc() the memory manager remembers them and does not reference...
34
13406
by: niranjan.singh | last post by:
This is regarding to test an SDK memory stuff. In what situation malloc gets fail. any comment/reply pls.... regards
6
3371
by: itsolution | last post by:
Hi folks, Could you shed some light on this issue? my program is running on Freebsd as a daemon. When user sends a request, it forks itself and lets its child process handles the request. And its main role is just to read a big xml file and save each object into its embedded DB(such as gdbm).
11
1684
by: pushpakulkar | last post by:
Hi all, Many users claim that malloc() and free() provided by the language library results in considerable amount of overhead in terms of calling the same. Can we really eliminate overhead by using used defined functions/user defined memory manager. Is there any significant advantage in providing user defined malloc() and free(). I want to exclude realtime systems or embedded systems which are memory constrained here.
0
1954
by: Akira Kitada | last post by:
Hi Marc-Andre, Thanks for the suggestion. I opened a ticket for this issue: http://bugs.python.org/issue4204 Now I understand the state of the multiprocessing module, but it's too bad to see math, mmap and readline modules, that worked fine before, cannot be built anymore.
0
1814
by: M.-A. Lemburg | last post by:
On 2008-10-25 20:19, Akira Kitada wrote: Thanks. The errors you are getting appear to be related to either some missing header files or a missing symbol definition to enable these - looking at the ticket, you seem to have resolved all this already :-)
0
9531
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
9345
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
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
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
8780
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...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
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...
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.