Toni:
Make the following edit to src/JudyCommon/JudyMallocIF.c
185c185,185
< Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
---
> Word_t Words = (sizeof(jpm_t) + cJU_BYTESPERWORD - 1) /
> cJU_BYTESPERWORD;
and see if your Buffer Overrun disappears.
Thanks,
Doug Baskins
Toni Cassisi <[EMAIL PROTECTED]> wrote: Keep in mind my main reason for asking
was due to the VS2005 fussiness,
something that could perhaps be a deficiency in its checking logic.
It looks like the "-" business first mentioned is to do with the weird
decision by Judy to store the remaining memory as opposed to the used
memory, so provided standard add/subtract are used, then doing a negate with
"-" is correct.
The problem is the comments around the second use in JudyPrivate.h:
#define JU_MASKLOWEREXC( BITPOS) ((BITPOS) - 1)
#define JU_MASKLOWERINC( BITPOS) (JU_MASKLOWEREXC(BITPOS) | (BITPOS))
#define JU_MASKHIGHERINC(BITPOS) (-(BITPOS))
#define JU_MASKHIGHEREXC(BITPOS) (JU_MASKHIGHERINC(BITPOS) ^ (BITPOS))
I'm not sure how to prove what the intention was, but they seem to be used
only for walking the JArray in sorted order OR to count the number of items.
Example: "-x" is equivalent to "~x + 1", so if the bitarray=0100 (base
2) and:
bitpos=3=0011, then, ~bitpos=1100 but -bitpos=1101
bitpos=2=0010, then, ~bitpos=1101 but -bitpos=1110
So far, ignoring the warning doesn't seem to have caused any problems in my
(limited) testing.
* Update on the buffer overrun:
The same thing occurs with the JudyL sources, no surprise really as they are
pretty similar.
However, I setup for Release mode, then ran all the source through the
pre-processor only then post-formatted it automatically with VS and things
are a lot clearer now: for me at any rate.
What is interesting is that I now never have any memory issues flagged up.
Perhaps the problem is due to an unintended side effect buried somewhere in
the DBGCODE() statements, or whatever else is being excluded by undefining
the DEBUG/_DEBUG et al variable?
I'm working to that theory for now.
* Final question
If trying to return-and-remove any item from within the set (managed by a
Judy1 structure), is it quicker to search from the first index or the
highest index?
I presume the JudyL and Judy1 are very similar in performance, although
there must be some differences due to the different data layouts.
Regards,
Toni.
----
Toni Cassisi
Tovica Ltd
http://www.tovica.com
Tel: +44 (0) 7971 874 054
IM: AOL/Yahoo/MSN: tcassisi
> -----Original Message-----
> From: Alan Silverstein [mailto:[EMAIL PROTECTED]
> Sent: 04 May 2007 16:36
> To: [email protected]; [EMAIL PROTECTED]
> Subject: Re: Issue with Bit mask and Buffer Overruns
>
> Toni et al, I know Doug was very comfortable with ~ and - operators and
> sometimes used them purposely without special commenting (where I might
> have explained the assumptions). Beyond that I need to save, study,
> and
> reply at greater length to your email later, unless Doug beats me to
> it.
>
> Alan
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel
Toni Cassisi <[EMAIL PROTECTED]> wrote: Keep in mind my main reason for asking
was due to the VS2005 fussiness,
something that could perhaps be a deficiency in its checking logic.
It looks like the "-" business first mentioned is to do with the weird
decision by Judy to store the remaining memory as opposed to the used
memory, so provided standard add/subtract are used, then doing a negate with
"-" is correct.
The problem is the comments around the second use in JudyPrivate.h:
#define JU_MASKLOWEREXC( BITPOS) ((BITPOS) - 1)
#define JU_MASKLOWERINC( BITPOS) (JU_MASKLOWEREXC(BITPOS) | (BITPOS))
#define JU_MASKHIGHERINC(BITPOS) (-(BITPOS))
#define JU_MASKHIGHEREXC(BITPOS) (JU_MASKHIGHERINC(BITPOS) ^ (BITPOS))
I'm not sure how to prove what the intention was, but they seem to be used
only for walking the JArray in sorted order OR to count the number of items.
Example: "-x" is equivalent to "~x + 1", so if the bitarray=0100 (base
2) and:
bitpos=3=0011, then, ~bitpos=1100 but -bitpos=1101
bitpos=2=0010, then, ~bitpos=1101 but -bitpos=1110
So far, ignoring the warning doesn't seem to have caused any problems in my
(limited) testing.
* Update on the buffer overrun:
The same thing occurs with the JudyL sources, no surprise really as they are
pretty similar.
However, I setup for Release mode, then ran all the source through the
pre-processor only then post-formatted it automatically with VS and things
are a lot clearer now: for me at any rate.
What is interesting is that I now never have any memory issues flagged up.
Perhaps the problem is due to an unintended side effect buried somewhere in
the DBGCODE() statements, or whatever else is being excluded by undefining
the DEBUG/_DEBUG et al variable?
I'm working to that theory for now.
* Final question
If trying to return-and-remove any item from within the set (managed by a
Judy1 structure), is it quicker to search from the first index or the
highest index?
I presume the JudyL and Judy1 are very similar in performance, although
there must be some differences due to the different data layouts.
Regards,
Toni.
----
Toni Cassisi
Tovica Ltd
http://www.tovica.com
Tel: +44 (0) 7971 874 054
IM: AOL/Yahoo/MSN: tcassisi
> -----Original Message-----
> From: Alan Silverstein [mailto:[EMAIL PROTECTED]
> Sent: 04 May 2007 16:36
> To: [email protected]; [EMAIL PROTECTED]
> Subject: Re: Issue with Bit mask and Buffer Overruns
>
> Toni et al, I know Doug was very comfortable with ~ and - operators and
> sometimes used them purposely without special commenting (where I might
> have explained the assumptions). Beyond that I need to save, study,
> and
> reply at greater length to your email later, unless Doug beats me to
> it.
>
> Alan
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel
Doug Baskins <[EMAIL PROTECTED]>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel