|
Hi, I am using glib,
it has a lot of functions that return strings that should be freed myself.
Can I, pass these functions to other functions?
Example: function1 returns a string that must be freed for the caller. function2 returns a pointer to a string...
Started by drigoSkalWalker on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Every time that code runs, function1() will be allocating more memory that never gets freed.
|
|
"I freed a thousand slaves I could have freed a thousand more if only they knew they were slaves."
Started by Yvelette Stines on
, 1 posts
by 1 people.
Answer Snippets (Read the full thread at pinterest):
|
|
Very general: Is there an easy way to tell which line of code last freed a block of memory when an access violation occurs?
Less general: My understanding of profilers is that they override the allocation and deallocation processes. If this is true, might...
Started by Sydius on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Perhaps if you....
I'm not aware of any profiler that tracks what you're looking for .
What profilers do is highly dependent on what they're profiling .
By overloading new/delete) to store this information.
No, not unless you provide your own allocators (e.g.
|
Ask your Facebook Friends
|
I thought I'd found the solution a while ago (see my blog ):
If you ever get the JavaScript (or should that be JScript) error "Can't execute code from a freed script" - try moving any meta tags in the head so that they're before your script tags.
...but...
Started by tjrobinson on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
(Not exactly the most helpful error message text in the world.)
It sounds like you've hit a bug/problem in the way some tags are handled... .
This error can occur in MSIE when a child window tries to communicate with a parent window which is no longer open .
|
|
On F# WikiBook under Encapsulating Mutable State section, there is a following code snippet.
> let incr = let counter = ref 0 fun () -> counter := !counter + 1 !counter;; val incr : (unit -> int) > incr();; val it : int = 1 > incr();; val...
Started by Sung Meister on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It's not a memory leak because or in an object), the ref cell will be freed when the closure is garbage collected..
Counter is freed from the heap when incr is no longer reachable.
|
|
Windows HeapFree, msvcrt free: do they cause the memory being freed to be paged-in? I am trying to estimate if not freeing memory at exit would speed up application shutdown significantly.
NOTE: This is a very specific technical question. It's not about...
Started by Constantin on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
If you have zillions of ....
Freeing a block may or may not touch the actual block in question, but it will certainly have to update other bookkeeping information in any case .
I'm almost certain the answer to the speed improvement question would be "yes" .
|
|
Duplicate : What REALLY happens when you don’t free after malloc?
Let's say, for example:
int main() { char* test = new char[50000]; return 0; }
What happens to the allocated memory after the program had finished? Does it get freed for other applications...
Started by Kronikarz on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Well in Windows the memory is freed such as DOS or some realtime operating systems....
Knows about, so when the program shuts down, any memory used by it gets freed, and is available it for system memory once the process using it has finished.
|
|
Is there a way to transfer ownership of the data contained in a std::vector (pointed to by, say T*data) into another construct, preventing having "data" become a dangling pointer after the vector goes out of scope?
EDIT: I DON'T WANT TO COPY THE DATA ...
Started by spirov on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Delete [] data....
Does something like this work for you?
int main() { double *data = 0; { vector<double> foo; // insert some elements to foo data = new double[foo.size()]; std::copy(foo.begin(), foo.end(), &data[0]); } // Pass data to Matlab function .
|
|
Let me start by saying that my understanding of how JNA and Java direct native memory allocations is visceral at best, so I'm trying to describe my understanding of what's going on. Any corrections in addition to responses would be great...
I'm running...
Started by Mark on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
The fact that you don't have problems when running GC manually seems to confirm .
Aren't freed.
|
|
I have been chasing down what appears to be a memory leak in a DLL built in Delphi 2007 for Win32. The memory for the threadvar variables is not freed if the threads still exist when the DLL is unloaded (there are no active calls into the DLL when it ...
Started by Mark Wilkins on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Thread....
For that to happen, though, the thread needs to terminate .
That happens in System._StartLib when Reason is DLL_Thread_Detach.
As you've already determined, thread-local storage will get released for each thread that gets detached from the DLL .
|