[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] memorry could not be "read" when run RSVP script



Hi Sean,

I used Microsoft Visual C++ 6.0 as the compiler (The platform is Windows 2000 Professional), 
and installed the "rsvp-patch-ns-2.1b6-0.5c.tar.gz"  according to README.RSVP. When I started 
compiling, an error occured in file "wfq.cc", it said:

----------------------------------------------------------------------------------------------------------------------------------------
wfq.cc<474> : error c2143: syntax error : missing ';' before '['.
NMAKE: fatal error U1077 : 'cl' : return code '0x2'
Stop.
----------------------------------------------------------------------------------------------------------------------------------------

The original codes are:

	Hashtable::Hashtable(int buckets) {
	  buckets_ = buckets;  
	  table_ = new (node *)[buckets];  // line 474, added by me
	  int i;
	  for (i = 0; i < buckets; i++) {
	    table_[i] = NULL;
	  }

I found in "rsvp-patch-ns-2.1b5-0.5c.tar.gz" that the codes were the same.
I wonder if there still exist memory leak problem in this block of codes.

Firstly,
 I ignored this problem by typing " nmake /if makefile.vc" ,            ( the /i means that ignore exit code)
the compilation passed. Then I run "ns rsvp_conf.tcl", the following errors occured:

----------------------------------------------------------------------------------------------------------------------------------------
The instruction at "0x00407511" referenced memory at "0x00000000". The memory could                    
not be "read". 
Click on OK to termintate the program
Click on CANCELL to debug the program
----------------------------------------------------------------------------------------------------------------------------------------

Secondly,
We made modification to these codes according to the following two schemes, and both passed compilation:

// Scheme 1:
   buckets_ = buckets;
   void *p;
   p = malloc(4*buckets);
   table_ = (node **)p;
   int i;
   for (i = 0; i < buckets; i++) {
     table_[i] = NULL;
   }

// Scheme 2:
 buckets_ = buckets;
  node *table_a;
  table_a = new node[buckets];
  table_ = (node **)table_a;
  int i;
  for (i = 0; i < buckets; i++) {
    table_[i] = NULL;
  }

But when I run "ns rsvp_conf.tcl", the same error occured. So these two schemes would not work either.
                                                            ~~~~~~~~~~~~~~~~~~~

UNIX system has its own memory protection measures, so this block of codes can pass compilation, 
but Windows system would not. I guess.

I wonder if you are building an array of pointer chain and making initialization to it using these codes.


Best regards

Xiaogang Zhu
3.22



-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

Hi Xiao,

> I installed the RSVP module with ns-2.1b6 according to the readme file
> you provided, but when I run rsvp_conf.tcl, I met the following errors
> (on Windows 2000):
>
> The instruction at "0x00407511" referenced memory at "0x00000000". The memory could
> not be "read".
> Click on OK to termintate the program
> Click on CANCELL to debug the program
>
> I don't know what it happened. In fact, the wfq.cc file could not pass
> compilation because of the error in line 474 "table_ = new (node
> *)[buckets]". I modified it to:

What error did you get? I think that this is valid code assuming that the
types are defined correctly. What compiler are you using?

>   void *p;
>    p = malloc(4*buckets);
>    table_ = (node **)p;
>
> Then the compilation passed.
>
> I found somebody else had also met this problem. I wonder if you are
> too busy to answer my question.
>
> Thanks very much!

I compiled and tested rsvp using the tests provided by Marc Greis.
However, I never used the software myself.

The tests ran on my solaris and linux boxes. I compiled it for ns-2.1b6
and ran it through some memory validation software (?) - software that
intercepts all memory allocation attempts and memory accesses. This found
no problems with ns+RSVP. The tests didn't cover all of the code and you
may be using some of the code that was not tested in this manner.

I haven't been keeping track of modifications to ns since this. Perhaps
RSVP does not work because of some changes that have taken place in ns. It
looks like the error that you're having is some kind of null pointer
exception which I did not uncover before.Can't run it through gdb on a
unix box can you?

Sean.

-----
Sean Murphy,                    Email: [email protected]
Teltec Ireland,                 Phone: +353-1-7005080
DCU, Dublin 9,                  Fax:   +353-1-7005092
Ireland.