Questions tagged [memory]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
284 views

Pset5 Speller Valgrind error

I got Pset5 Speller to work correctly but I am getting a Valgrind error as follows 568 bytes in 1 blocks are still reachable in loss record 1 of 1: (file: dictionary.c, line: 108) for all the words. ...
2
votes
2answers
1k views

What will realloc() do if the contiguous memory location is already occupied?

Consider- char* name1 = malloc(4 * sizeof(char)); name1 = "Mike"; Now if i want to put "Mike Smith" in the same string "name1", I need 6 more bytes of memory (one for the space and 5 for "Smith". ...
1
vote
1answer
706 views

Memory allocation: recommended practices

I'm rambling a little with hacker 2 (the passwords') and, in the meantime, gained some insight about pointers, mem-alloc, 'valgrind', etc... It's been a truly great, challenging experience. But, ...
0
votes
1answer
620 views

Memory allocation when using struct to defined a user defined type

When a user defined type is defined using struct then does it get memory allocation on heap or stack? I am sure that when malloc is used than memory allocation happens on heap but in case of user ...
0
votes
1answer
20 views

pset5 speller memory errors with valgrind

i've been working in pset5 and cannot make it work. I've read some similar questions and made some improvements to my code, but still can't figure what is wrong. Any tips are welcomed! Here is my code:...