Re[7]: [Gc] Bus error && Deallocation of excessively large block ..
Ivan Maidanski
ivmai at mail.ru
Sat Jul 14 02:08:21 PDT 2012
Hi Arote,
1. GC_THREADS forces gc.h to include pthread.h and redirect pthread_create to GC_pthread_create.
If GC_THREADS is not defined then single-threaded mode is assumed.
2. If you want to make standard malloc behave like GC_MALLOC, please look to --enable-redirect-malloc GC option.
Regards,
Ivan
Sat, 14 Jul 2012 14:34:04 +0530 Arote Uddhav <aroteuddhav at gmail.com>:
Hi ,
GC cannot collect those memory allocations which are allocated by explicit use of malloc ?
With threads I am using few external libraries which are sort of leaky .. can we make GC to be a global garbage collector ,by this I mean , GC will recollect all the memory locations which are not pointed by any pointers,not necessarily using GC_MALLOC
On Sat, Jul 14, 2012 at 2:28 PM, Arote Uddhav <aroteuddhav at gmail.com> wrote:
Hi ,well .. it worked !
But why is this restriction
#define GC_THREADS
#include "gc.h"
why should we follow this order ... special reason ?
On Sat, Jul 14, 2012 at 2:19 PM, Ivan Maidanski <ivmai at mail.ru> wrote:
Hi Arote,
Sat, 14 Jul 2012 14:08:03 +0530 Arote Uddhav <aroteuddhav at gmail.com>:
> Hi All ,
>
> Until now I have used only GC_MALLOC and GC_INIT functions in the program code.
> platform : ubuntu Linux
ok.
>
>
> In the file where I declared this piece of code I used
> #define GC_THREADS
must be before #include <gc.h>
>
>
> Well,.is it we need to initialize GC at evry function where it is used..I have used only at the start of the main function...?
GC_INIT(); must be only at the beginning of main().
>
>
> Thank you ,Uddhav!
>
>
> On Sat, Jul 14, 2012 at 1:53 PM, Ivan Maidanski <ivmai at mail.ru> wrote:
> Hi Arote,
>
> "Collecting unknown thread" means you call some GC function from a thread not registered by GC.
>
> What's your target platform?
> Check that pthread_create is redirected to GC_pthread_create.
Have you checked this?
Regards,
Ivan
>
> The given code fragment seems to be valid (Are there any other places GC is called?)
>
> Regards,
> Ivan
>
> Sat, 14 Jul 2012 13:46:02 +0530 Arote Uddhav <aroteuddhav at gmail.com>:
>
> > No luck.. !
> >
> > On Sat, Jul 14, 2012 at 1:29 PM, Ivan Maidanski <ivmai at mail.ru> wrote:
> >
>
>
> > > Hi Arote,
> > >
> > > Please ensure that you have in the code:
> > >
> > > #define GC_THREADS
> > > #include <gc.h>
> > >
> > > ...
> > >
> > > main() {
> > > GC_INIT();
> > >
> > > Regards,
> > > Ivan
> > >
> > > Wed, 11 Jul 2012 15:11:12 +0530 Arote Uddhav <aroteuddhav at gmail.com>:
> > > > Hi All ,
> > > > I am trying gc with my program. I need to create threads at run time.
> > > >
> > > >
> > > > <code>
> > > > while(1)
> > > > {
> > > > pthread *t = (pthread_t *) GC_MALLOC( num_of_files * sizeof (pthread_t
> > > ));
> > > > int *iret = (int *) GC_MALLOC( num_of_files * sizeof (int ));
> > > >
> > > > .........
> > > >
> > > > while( ( dirp = readdir( d )) != NULL )
> > > > {
> > > > if ( ( stat( dirp->d_name , &stat_buf) != -1 ) && (S_ISREG(
> > > > stat_buf.st_mode ) ))
> > > > {
> > > > iret [ fileCounter ] = pthread_create ( &t [ fileCounter ] , NULL ,
> > > > callPluginHandle , (void *)(dirp->d_name) ) ;
> > > > fileCounter ++;
> > > > }
> > > > }
> > > > ...........
> > > > }
> > > > </code>
> > > >
> > > > This is a code prototype which I am trying to write. But I get run
> > > time
> > > > problmes
> > > > ----- Bus error
> > > > ----- Deallocation exclusively large block
> > > > ----- Collecting unknown thread
> > > >
> > > > I am not doing any free or deallocation .. I am relying on gc for all
> > > > memory freeing !
> > > > Help required ! :)
> > > >
> > > > --
> > > > *Uddhav Arote*
> > > >
> > > > Mob Number : +91 9767168079
> > > > *Vidyavardhini College Of Engg. and Tech,Mumbai(MAHARASHTRA).*
> > >
> >
> >
> >
> > --
> > *Uddhav Arote*
> >
> > Mob Number : +91 9767168079
> > *Vidyavardhini College Of Engg. and Tech,Mumbai(MAHARASHTRA).*
> >
> >
>
> > Life is no brief candle for me. It is a sort of splendid torch which I have
> > got hold of for the moment, and I want to make it burn as brightly as
> > possible before handing it on to future generations.
> > -George Bernard Shaw
> >
> > * <Email-id:aroteuddhav at gmail.com>*
> >
> >
>
>
>
>
> --
>
> Uddhav Arote
>
> Mob Number : +91 9767168079
> Vidyavardhini College Of Engg. and Tech,Mumbai(MAHARASHTRA).
>
>
> Life is no brief candle for me. It is a sort of splendid torch which I have got hold of for the moment, and I want to make it burn as brightly as possible before handing it on to future generations.
> -George Bernard Shaw
>
>
>
>
--
Uddhav Arote
Mob Number : +91 9767168079
Vidyavardhini College Of Engg. and Tech,Mumbai(MAHARASHTRA).
Life is no brief candle for me. It is a sort of splendid torch which I have got hold of for the moment, and I want to make it burn as brightly as possible before handing it on to future generations.
-George Bernard Shaw
--
Uddhav Arote
Mob Number : +91 9767168079
Vidyavardhini College Of Engg. and Tech,Mumbai(MAHARASHTRA).
Life is no brief candle for me. It is a sort of splendid torch which I have got hold of for the moment, and I want to make it burn as brightly as possible before handing it on to future generations.
-George Bernard Shaw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20120714/cd1ffe73/attachment.htm
More information about the Gc
mailing list