I am working on a program that requires me to make use of 4 matrices sized [1000][1000].
I have created them using malloc()
, but when I try running the program it just crashes and the memory usage shoots up to 2.5 GB. Please suggest any solution as soon as possible. I would be grateful..
views:
94answers:
2
A:
Why don't you run the program inside a debugger, such as gdb
, to see exactly where it crashes? It will help you narrow down the problem.
RarrRarrRarr
2010-04-10 06:02:36
I disagree with this being down-voted... given the information present, I think that's about the best answer one could give. =P
Chris Cooper
2010-04-10 06:05:20
Being the "best answer one can give" doesn't necessarily make it a particularly good answer, though. Personally, I wouldn't downvote it, but I wouldn't be inclined to upvote it either.
Brooks Moses
2010-04-10 06:08:15
+1
A:
4 matrices sized [1000][1000]
Why use malloc()
when you know at compile time how much memory you need? Dynamically allocating two-dimentional arrays is not the most trivial thing to do, neither is freeing them (see the C FAQ, Question 2.14 on one way to do this). Do not over-complicate your programs.
RWS
2010-07-23 13:26:21