On 10/22/2012 7:27 PM, Doug Baskins wrote:
The definition of Word_t must pass this: assert(sizeof(Word_t) == sizeof (void *); or Judy will not work. Also, if this does not pass, Judy will not work: assert(sizeof(jp_t) == (2 * sizeof(void *)));
Those asserts are passing, but I'm hitting a couple runtime errors in the test code I've written, and I'm wondering if anyone has any ideas.

My test code: I'm populating a JudySL tree with a few strings, each mapped to a uint value. Then I'm looking up each string to confirm it maps to the right key. Then I'm iterating through the tree. (I'm stepping through the code in the Visual Studio IDE and confirming the values of the variables in a "Watch" window, rather than doing printouts.)

It works in 32-bit mode, up until the call to JSLF(). At that point, it crashes. The other problem happens in 64-bit mode when populating the tree: The first call to JSLI() works fine, but then I get an access violation the second time.

Here's the code:
--------------------------
    Pvoid_t JudySLRoot = NULL;   // main JudySL array
    Pvoid_t  PValue = NULL;         // pointer to JudySL array value
char *Strings[11] = {"zoo", "ark", "Zed", "Ate", "basdfahsdfkjashdflkjashdflkjahsljkhfeiuahslfkje", "model", "Man", "fire", "f.re", "quorum" };

for (uint64_t I=0; I<10; I++) //map each string to its index in the Strings array
    {
        char *String_Key = Strings[I];
        JSLI(PValue, JudySLRoot, (uint8_t*)String_Key);
        *((Word_t*)PValue) = I;
    }

    uint64_t Retrieved;
for (uint64_t I=0; I<10; I++) //Confirm that the stored values match each string's index
    {
        char *String_Key = Strings[I];
        JSLG(PValue, JudySLRoot, (uint8_t*)String_Key);
        Retrieved = *((Word_t*)PValue);
    }

    uint8_t *Retrieved_String=NULL;
    PValue = NULL;
    JSLF(PValue, JudySLRoot, Retrieved_String);
    while (PValue!=NULL)  //Iterate through the table.
    {
        char *String = (char*)Retrieved_String;
        Retrieved = *((Word_t*)PValue);
        JSLN(PValue, JudySLRoot, Retrieved_String);
    }
--------------------------

Any ideas?

I did confirm that the 64-bit version of the *.lib is using the 64-bit tables, by the way. (The generated *.c tables include j__L_Leaf1 through j__L_Leaf7.)


---
Tim Margheim
Neuric Technologies, LLC
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to