[Gc] Silently fails to allocate memory?

The Devils Jester thedevilsjester at gmail.com
Sat Apr 13 09:35:48 PDT 2013


On Sat, Apr 13, 2013 at 12:55 AM, Bruce Hoult <bruce at hoult.org> wrote:

> It shouldn't "give up". I've never seen such a thing. And you don't
> describe what you mean by "give up" or "silently fail". Does it return a
> null pointer?
>

As far as I can tell, yes.  I am working on digging deeper to find exactly
what happens when it hits its magic number.  After it "fails" (with no
message of any kind) it continues on as if everything is OK, but the
creation of new objects as far as I can tell just stops.


> If all you are doing is allocating memory then unfreed memory is the worst
> that can happen. If you were relying on C++ destructors to close files then
> you could run out of file handles.Or similar for other resources.
>
>

I am not doing anything in any destructor and have no file, stream, or
other handles that need closed so I am not worried about destructors.

If my object has a vector of pointers, would not those be automatically
>> collected as well?
>>
> Of course, if those pointers were to memory allocated by GC and there are
> no other live pointers to those objects. And if the memory for the vector
> itself has been allocated by GC.
>
>

I might not be understanding this correctly.  Additional comments say that
memory for my objects in a vector are created using malloc, but I
explicitly use the new operator, for example:
vector<myclass*> a;
myclass* b = new myclass();
a.push_back(b);

If myclass inherits from gc, and I use the new operator (that has been
overloaded by libgc) what would be the issue here?  Am I missing something?

On Sat, Apr 13, 2013 at 7:54 AM, Brian Beuning <bbeuning at corecard.com>
 wrote:

> The simplest answer is your process is running out of memory.
> Try using the ps(1) command to check your process size.
>

How would this be true?  If I dont GC, and just let the memory grow and
grow, it works perfectly.  If anything shouldn't it run out of memory
without GC long before it does so with GC?


On Sat, Apr 13, 2013 at 7:54 AM, Brian Beuning <bbeuning at corecard.com>
 wrote:

> (Overriding the global operator new might work on Linux, it does not work
> on Windows.)
>

Its actually Linux where the problem lies.  Mac OS X (appears) to work just
fine (or has a much much higher limit before it gives up).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20130413/f11ba611/attachment.htm


More information about the Gc mailing list