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

malloc fails

hi,

in my code i am creating a tree, which have a 20 levels and and each level we have 10 nodes. i.e every node can have a 10 children. for them i am allocating memory for each node.

each node is stracuture which occupies the memmory around 40 bytes.

i have 456 files, each file have more then 18000 data, i.e. for each file 18000+ nodes are created. when coressponding output is written to ourfile for every file, memeory allocated is made free.



but after o the same for 450 files....my c code fails...

nor i am looking that how can i reuse the memory which had been free by my progrm again.



can anybody help.
Sep 18 '06 #1
1 1784
tyreld
144 100+
hi,

in my code i am creating a tree, which have a 20 levels and and each level we have 10 nodes. i.e every node can have a 10 children. for them i am allocating memory for each node.

each node is stracuture which occupies the memmory around 40 bytes.

i have 456 files, each file have more then 18000 data, i.e. for each file 18000+ nodes are created. when coressponding output is written to ourfile for every file, memeory allocated is made free.



but after o the same for 450 files....my c code fails...

nor i am looking that how can i reuse the memory which had been free by my progrm again.



can anybody help.

A listing of the problem code as well as what exactly the reported error is would be helpful.
Sep 18 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Ian Roddis | last post by:
Hi all, I've written some code to make a hash data structure and associated funtions (insert, delete, search). In the delete function, I want to free() the key and the associated value. But...
4
by: Tank | last post by:
ld.so.1: internal: malloc failed I'm getting the above on a simple fopen() in a production program. I know that fopen calls malloc, but what would cause this and how do I fix it? Have I hit...
25
by: H.A. Sujith | last post by:
If malloc fails what should I do? 1. Exit imediately. 2. Print an error message (or put a log entry) and exit. 3. Print an error message (or put a log entry) and continue execution (after...
6
by: I_have_nothing | last post by:
Hi! I am new in C. I try to use dynamical allocation fuction malloc( ) and realloc( ). I found something strange. After several calling realloc( ), the malloc( ) will give me a Segmentation...
12
by: gooch | last post by:
I originally posted the following code in a group discussing threads but after further research I think I have a c question about the code. I know there are a couple of non standard c includes here...
17
by: Chen Shusheng | last post by:
Hi all, In fact, I want to let my memory run out. And see what will happen. My system is windowsXp. Memory is 256M.I think my cdes will apply more memory than I have. Codes are below: ...
6
by: sam_cit | last post by:
Hi Everyone, I wanted to know as to how malloc() works, if my understanding is correct, it is implementation specific of the vendor who provides the library(alloc.h). If so, is there any...
71
by: desktop | last post by:
I have read in Bjarne Stroustrup that using malloc and free should be avoided in C++ because they deal with uninitialized memory and one should instead use new and delete. But why is that a...
6
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....
173
by: Marty James | last post by:
Howdy, I was reflecting recently on malloc. Obviously, for tiny allocations like 20 bytes to strcpy a filename or something, there's no point putting in a check on the return value of malloc....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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,...

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.